From c807e733b8d71208869ba34ce5e987f5172ef8f2 Mon Sep 17 00:00:00 2001 From: Adam Dobrawy Date: Sat, 21 Apr 2018 07:36:40 +0200 Subject: [PATCH] Use tox in TravisCI (DRY!) --- .travis.yml | 66 ++++++++++++++++++++++++----------------------------- tox.ini | 3 ++- 2 files changed, 32 insertions(+), 37 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0ef7379..3501212 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,48 +1,42 @@ language: python -python: -- '2.7' -- '3.4' -- '3.5' -- '3.6' +python: '3.5' env: matrix: - - DJANGO='>=1.7,<1.8' - - DJANGO='>=1.8,<1.9' - - DJANGO='>=1.9,<1.10' - - DJANGO='>=1.10,<1.11' - - DJANGO='>=1.11,<2.0' - - DJANGO='>=2.0,<2.1' +# sort by django version, next to by python version +# Django 1.7 support Python 2.7, 3.4 + - TOX_ENV=django17-py27 + - TOX_ENV=django17-py34 +# Django 1.8 support Python 2.7, 3.4, 3.5 + - TOX_ENV=django18-py27 + - TOX_ENV=django18-py34 + - TOX_ENV=django18-py35 +# Django 1.9 support Python 2.7, 3.4, 3.5 + - TOX_ENV=django19-py27 + - TOX_ENV=django19-py34 + - TOX_ENV=django19-py35 +# Django 1.10 support Python 2.7, 3.4, 3.5 + - TOX_ENV=django110-py27 + - TOX_ENV=django110-py34 + - TOX_ENV=django110-py35 +# Django 1.11 support all supported Python interpreter +# Django 2.0 support Python 3.4, 3.5, 3.6 + - TOX_ENV=django111-py34 + - TOX_ENV=django111-py35 + - TOX_ENV=django111-py36 + global: - secure: aswHU7pQroGM+GHoYlhXzzk2FYfqxXJORjqXPsbgoHAIu4Bssaj8+YAzIcdy3j9kSt4I8VBpjnn8H/wzQXki75JBZOosQrIeMK018+uR+ZMONBLqDYW/N7EJHLgZt9QXxQNKeZygrD4GN/Dc4gLHGvPQC/RfPuuHcnF0Liaahoo= - secure: RZ6M6984P885GRoyx9n/WCCWGoFAzYpS8sZkXu3e/HK9oPXfaM2IEHjkq03jIC/FcWn/QMtFjOUBqQU94rnqdivFdFkeZHk1WUQgC0hztH3Qhh9zu2PNIrYUDpVD5dJqBpprWbSwFP8yNsJlP9A2RUubTlZblKHuaBhhiuNN+kU= - secure: gsAAl/RaTodLJDHWOuHZWtooa9/psyXBONF7ElZOTki3WvH+KugtjuXn3pXBGbUhvGqd5qfgPqX7WQOFP9KTdkXBbkU20rCHLh3SV8V2vRkGFAFiGPBTFfSA83zFNMvmgEnTww4OzYsfs4wHTEyxBeQkggnB5bXEvqkFVrHBjuQ= - secure: mMa7UUt+CQDB52fGM1T3oRL67OzQzRIc+BQCOqUEUhBV7p5g7Y1Hv6NTdVZTvK16x3DsP+5kFNd1v7rsTFw2qzP3hOxIv2BtMPuSzZdnN85Zd/nGwnztxzj/rqw7TMBaYvIdEZZbpRF/K0p0Xr6LJK2s9UkPXPUaLqly7kNi360= -matrix: - exclude: -# sort by django version, next to by python version -# Django 1.7 support Python 2.7, 3.4 - - env: DJANGO='>=1.7,<1.8' - python: '3.5' - - env: DJANGO='>=1.7,<1.8' - python: '3.6' -# Django 1.8 support Python 2.7, 3.4, 3.5 - - env: DJANGO='>=1.8,<1.9' - python: '3.6' -# Django 1.9 support Python 2.7, 3.4, 3.5 - - env: DJANGO='>=1.9,<1.10' - python: '3.6' -# Django 1.10 support Python 2.7, 3.4, 3.5 - - env: DJANGO='>=1.10,<1.11' - python: '3.6' -# Django 1.11 support all supported Python interpreter -# Django 2.0 support Python 3.4, 3.5, 3.6 - - env: DJANGO='>=2.0,<2.1' - python: '2.7' + install: - - pip install -q Django$DJANGO - - pip install -r test_requirements.txt - - pip install -q -e . + - pip install tox + script: - - python manage.py test + # Update Python 3.6 path - see bug https://github.com/travis-ci/travis-ci/issues/4990 + - if [[ $TOX_ENV = *"py36"* ]]; then echo "Activated PY3.6"; source ~/virtualenv/python3.6/bin/activate; pip install tox; fi + - tox -e $TOX_ENV + sudo: false diff --git a/tox.ini b/tox.ini index f6c3ab7..c7d6a2b 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,7 @@ envlist= py{34,35,36}-django20 [testenv] +passenv=EMAIL_IMAP_SERVER EMAIL_ACCOUNT EMAIL_PASSWORD EMAIL_SMTP_SERVER deps= django17: django>=1.7,<1.8 django18: django>=1.8,<1.9 @@ -23,7 +24,7 @@ commands= django110: python {toxinidir}/manage.py makemigrations --check --dry-run django111: python {toxinidir}/manage.py makemigrations --check --dry-run django20: python {toxinidir}/manage.py makemigrations --check --dry-run - python manage.py test {posargs} + python manage.py test -v2 {posargs} [testenv:flake8] deps=flake8