[PATCH 6/7] Enable tox tests in Docker
Daniel Axtens
dja at axtens.net
Tue Aug 2 13:46:15 AEST 2016
Daniel Axtens <dja at axtens.net> writes:
> * Install the python2 dev packages. Update the readme to tell
> people we now download > 200MB of packages, not ~ 200MB.
>
> * Update the tox.ini file:
>
> * python3.4 -> python3.5 as that's what's shipped with Ubuntu 16.04
> * Drop Django 1.6, it's not supported by django-request-framework
That should be django-rest-framework.
I'd like to revise this patch anyway; it seems d-r-f should be pluggable
so we should be able to test on 1.6 without it.
Apparently 1.6 is also shipped with RHEL7.2 so supporting it is important.
> * Drop Django 1.7, it seems to break with sqlparse
And if we're supporting 1.6 we should probably support 1.7 so I'll chase
this down.
Regards,
Daniel
>
> If any of these changes are controversial I'm happy to revisit them.
> Also:
>
> * Pass in the new environment variables for db host and port.
> * Pass in DISPLAY, XAUTHORITY and HOME to fix seleinum tests.
>
> * Update the entrypoint script to allow you to do --tox and
> --quick-tox in the same way as --test and --quick-test.
> Update the readme appropriately.
>
> Signed-off-by: Daniel Axtens <dja at axtens.net>
> ---
> README.md | 4 +++-
> docker/Dockerfile | 3 ++-
> docker/entrypoint.sh | 7 +++++++
> tox.ini | 9 ++++-----
> 4 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/README.md b/README.md
> index 6f889c09def0..ca212bc6d707 100644
> --- a/README.md
> +++ b/README.md
> @@ -36,7 +36,7 @@ of community projects.
>
> 1. Install Docker and docker-compose.
> 2. Clone this repo, as with vagrant.
> -3. Build the images. This will download ~200MB from the internet:
> +3. Build the images. (This will download over 200MB from the internet.)
>
> $ docker-compose build
>
> @@ -60,6 +60,8 @@ of community projects.
>
> $ docker-compose run --rm web --test
>
> + * Tox tests can be run with `--quick-tox` and `--tox`.
> +
> * To reset the database before beginning, add `--reset` to the command line after `web` and before any other arguments.
>
> * If you want to run non-headless tests, you'll need something like this ugly hack:
> diff --git a/docker/Dockerfile b/docker/Dockerfile
> index 507e6c843fe2..365becd107ca 100644
> --- a/docker/Dockerfile
> +++ b/docker/Dockerfile
> @@ -20,7 +20,8 @@ COPY docker/google-chrome.list /etc/apt/sources.list.d/
> # to install succesfully
> RUN apt-get update -qq && \
> apt-get install -y --allow-unauthenticated --no-install-recommends \
> - python python3-dev python3-pip python3-setuptools python3-wheel \
> + python-dev python-pip python-setuptools python-wheel \
> + python3-dev python3-pip python3-setuptools python3-wheel \
> libmysqlclient-dev mysql-client curl unzip xvfb google-chrome-stable \
> hicolor-icon-theme build-essential && \
> curl http://chromedriver.storage.googleapis.com/$chromedriver_version/chromedriver_linux64.zip -o /tmp/chromedriver.zip && \
> diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
> index 7a42165455b1..15b8dceee2a5 100755
> --- a/docker/entrypoint.sh
> +++ b/docker/entrypoint.sh
> @@ -71,6 +71,13 @@ elif [ "$1" == "--quick-test" ]; then
> python3 manage.py test
> elif [ "$1" == "--test" ]; then
> xvfb-run --server-args='-screen 0, 1024x768x16' python3 manage.py test
> +elif [ "$1" == "--quick-tox" ]; then
> + shift
> + export PW_SKIP_BROWSER_TESTS=yes
> + tox $@
> +elif [ "$1" == "--tox" ]; then
> + shift
> + xvfb-run --server-args='-screen 0, 1024x768x16' tox $@
> else # run whatever CMD is set to
> $@
> fi
> diff --git a/tox.ini b/tox.ini
> index d1703251a197..4050d1f8e7b9 100644
> --- a/tox.ini
> +++ b/tox.ini
> @@ -1,21 +1,20 @@
> [tox]
> minversion = 2.0
> -envlist = py{27,34}-django{16,17,18,19}
> +envlist = py{27,35}-django{18,19}
> skipsdist = True
>
> [testenv]
> deps =
> -r{toxinidir}/requirements-test.txt
> - django16: django>=1.6,<1.7
> - django17: django>=1.7,<1.8
> django18: django>=1.8,<1.9
> django19: django>=1.9,<1.10
> setenv =
> DJANGO_SETTINGS_MODULE = patchwork.settings.dev
> passenv =
> http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
> - PW_TEST_DB_TYPE PW_TEST_DB_USER PW_TEST_DB_PASS
> - DISPLAY SELENIUM_BROWSER PW_SKIP_BROWSER_TESTS
> + PW_TEST_DB_TYPE PW_TEST_DB_USER PW_TEST_DB_PASS PW_TEST_DB_HOST
> + PW_TEST_DB_PORT DISPLAY SELENIUM_BROWSER PW_SKIP_BROWSER_TESTS
> + DISPLAY HOME XAUTHORITY
> commands =
> {toxinidir}/manage.py test --noinput --liveserver=localhost:9000-9200 \
> '{posargs:patchwork}'
> --
> 2.7.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 859 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/patchwork/attachments/20160802/8b7505a3/attachment.sig>
More information about the Patchwork
mailing list