From c91bbef22c52a27ac7884df8ff979d0994a0818d Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 5 Apr 2015 18:43:41 +0200 Subject: [PATCH] travis: use tox / TOXENV --- .travis.yml | 50 ++++++++++++++++++++++++++++++-------------------- tox.ini | 4 +++- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2c4ac3e48..87d385f0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,37 +18,46 @@ matrix: - python: "2.7" env: REQ="django<1.8 django-taggit" python: - - "2.7" - "3.4" env: global: # Create wheels (skips existing ones from the cached wheelhouse). - export PIP_FIND_LINKS=$PWD/wheelhouse/ + - TESTS_SKIP_LIVESERVER=1 matrix: - - TESTS_SKIP_LIVESERVER=1 REQ="django<1.5 django-taggit django-generic-m2m" - - TESTS_SKIP_LIVESERVER=1 REQ="django<1.6 django-taggit django-generic-m2m" - - TESTS_SKIP_LIVESERVER=1 REQ="django<1.7 django-taggit django-generic-m2m" - - TESTS_SKIP_LIVESERVER=1 REQ="django<1.8 django-taggit django-generic-m2m" + - TOXENV=py27-django14-taggit-genericm2m + - TOXENV=py27-django15-taggit-genericm2m + - TOXENV=py27-django16-taggit-genericm2m + - TOXENV=py27-django17-taggit-genericm2m + + # Current stable Django. + - TOXENV=py27-django18 + - TOXENV=py27-django18-taggit + - TOXENV=py27-django18-taggit-genericm2m TESTS_SKIP_LIVESERVER= REQ="pytest-cov" + - TOXENV=py27-django18-genericm2m + - TOXENV=py27-django19-taggit-genericm2m + - TOXENV=py27-master + + - TOXENV=py34-django15-taggit-genericm2m + - TOXENV=py34-django16-taggit-genericm2m + - TOXENV=py34-django17-taggit-genericm2m # Current stable Django. - - REQ="django<1.9 django-taggit django-generic-m2m" - - TESTS_SKIP_LIVESERVER=1 REQ="django<1.9 django-generic-m2m" - - TESTS_SKIP_LIVESERVER=1 REQ="django<1.9 django-taggit" - # django-master. - - TESTS_SKIP_LIVESERVER=1 REQ="-e git+https://github.com/django/django.git@master#egg=django django-taggit django-generic-m2m" + - TOXENV=py34-django18 + - TOXENV=py34-django18-taggit + - TOXENV=py34-django18-taggit-genericm2m TESTS_SKIP_LIVESERVER= REQ="pytest-cov" + - TOXENV=py34-django18-genericm2m + - TOXENV=py34-django19-taggit-genericm2m + - TOXENV=py34-master - REQ="pep8" install: - # NOTE: Django 1.4 wheel is broken; skip it (https://github.com/django/django/pull/2438). - - if [[ $REQ != "django<1.5 django-taggit django-generic-m2m" ]]; then pip wheel $REQ; fi - - pip wheel pep8 coveralls - - pip wheel -r test_project/test_requirements.txt + # Create wheelhouse / cache. + - pip wheel pep8 psycopg2 tox $REQ + - pip wheel -r test_project/test_requirements_without_django.txt # Install from wheelhouse. - # NOTE: Django 1.4 wheel is broken; skip it (https://github.com/django/django/pull/2438). - - if [[ $REQ == "django<1.5 django-taggit django-generic-m2m" ]]; then pip install $REQ; fi + - pip install psycopg2 tox $REQ - export PIP_NO_INDEX=1 - - pip install $REQ psycopg2 -r test_project/test_requirements_without_django.txt - - pip install -e . - pip freeze before_script: - which pep8 || psql -c 'create database autocomplete_light_test;' -U postgres @@ -56,9 +65,9 @@ before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" script: - - RUN_TESTS="test_project/manage.py test --traceback autocomplete_light --settings=test_project.settings_postgres" + - RUN_TESTS="tox -- autocomplete_light --ds=test_project.settings_postgres" # Run tests either with or without coverage (being installed). - - command -v coveralls && RUN_TESTS="coverage run --source=autocomplete_light $RUN_TESTS" || true + - command -v coveralls && RUN_TESTS="$RUN_TESTS --cov" || true # Run pep8 or the tests. - which pep8 && { pep8 --exclude=example_apps,tests,migrations --ignore=E124,E128 autocomplete_light; return $?; } || travis_retry $RUN_TESTS after_success: @@ -74,3 +83,4 @@ notifications: cache: directories: $PWD/wheelhouse/ + $PWD/.tox/ diff --git a/tox.ini b/tox.ini index 521e2c6a0..9953e126b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{27,34}-django{15,16,17,18,19,-master} py27-django14 +envlist = py{27,34}-django{15,16,17,18,19,-master}{,-taggit}{,-genericm2m}, py27-django14 [testenv] usedevelop = true @@ -13,6 +13,8 @@ deps = django19: https://github.com/django/django/archive/stable/1.9.x.zip django-master: https://github.com/django/django/archive/master.zip -rtest_project/test_requirements_without_django.txt + taggit: django-taggit + genericm2m: django-generic-m2m setenv = DJANGO_SETTINGS_MODULE=test_project.settings PIP_ALLOW_EXTERNAL=true