From 7dbe8c063f822de2e4d76a25815ec83313ee1551 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Tue, 26 Nov 2013 12:25:07 +0100 Subject: [PATCH] Ported tests to run via tox and Travis. --- .travis.yml | 44 ++++---- tasks.py | 17 --- test_project/test_project/settings.py | 2 - tests/requirements.txt | 10 -- tox.ini | 147 ++++++++++++++++++++++++++ 5 files changed, 171 insertions(+), 49 deletions(-) delete mode 100644 tasks.py delete mode 100644 tests/requirements.txt create mode 100644 tox.ini diff --git a/.travis.yml b/.travis.yml index bd862c5..0abfa03 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,29 @@ language: python -python: - - 2.6 - - 2.7 - - 3.2 - - 3.3 -install: - - pip install -e . - - pip install -r tests/requirements.txt - - pip install https://github.com/django/django/archive/${DJANGO}.zip#egg=django -script: - - inv test env: - - DJANGO=1.4.6 - - DJANGO=1.5.2 - - DJANGO=stable/1.6.x -matrix: - exclude: - - python: 3.2 - env: DJANGO=1.4.6 - - python: 3.3 - env: DJANGO=1.4.6 + - TOXENV=py26-1.4.x + - TOXENV=py26-1.5.x + - TOXENV=py26-1.6.x + - TOXENV=py26-1.7.x + - TOXENV=py27-1.4.x + - TOXENV=py27-1.5.x + - TOXENV=py27-1.6.x + - TOXENV=py27-1.7.x + - TOXENV=py32-1.5.x + - TOXENV=py32-1.6.x + - TOXENV=py32-1.7.x + - TOXENV=py33-1.5.x + - TOXENV=py33-1.6.x + - TOXENV=py33-1.7.x + - TOXENV=pypy-1.4.x + - TOXENV=pypy-1.5.x + - TOXENV=pypy-1.6.x + - TOXENV=pypy-1.7.x + - TOXENV=flake827 + - TOXENV=flake833 +install: + - pip install tox +script: + - tox branches: except: templates/1.5.x diff --git a/tasks.py b/tasks.py deleted file mode 100644 index aa91a58..0000000 --- a/tasks.py +++ /dev/null @@ -1,17 +0,0 @@ -from invoke import run, task - - -@task -def test(label='tests'): - run('flake8 configurations --ignore=E501,E127,E128,E124') - run('./manage.py test {0} -v2'.format(label)) - - -@task -def release(): - run('python setup.py sdist bdist_wheel register upload -s') - - -@task -def docs(): - run('cd docs; make html; cd ..') diff --git a/test_project/test_project/settings.py b/test_project/test_project/settings.py index d3a1086..334cee6 100644 --- a/test_project/test_project/settings.py +++ b/test_project/test_project/settings.py @@ -129,7 +129,6 @@ class Base(Configuration): # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', 'configurations', - 'django_extensions', ) # A sample logging configuration. The only tangible logging @@ -173,7 +172,6 @@ class Base(Configuration): # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', 'configurations', - 'django_extensions', ) diff --git a/tests/requirements.txt b/tests/requirements.txt deleted file mode 100644 index 7829f2a..0000000 --- a/tests/requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -flake8 -coverage -django-discover-runner -mock -dj-database-url -dj-email-url -django-cache-url>=0.6.0 -# use a unreleased version of invoke since it's compatible with 3.2 -https://github.com/pyinvoke/invoke/archive/771110190ddb729913e8afc67724b84f42e6176d.zip -six diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..63d0930 --- /dev/null +++ b/tox.ini @@ -0,0 +1,147 @@ +[tox] +; envlist = py26,py27,pypy,py32,py33,flake827,flake833 +;envlist = py26-1.4.x + +[testenv] +skipsdist = True +usedevelop = True +deps = + flake8 + coverage + django-discover-runner + mock + dj-database-url + dj-email-url + django-cache-url>=0.6.0 + six +deps14 = + https://github.com/django/django/archive/stable/1.4.x.zip#egg=django +deps15 = + https://github.com/django/django/archive/stable/1.5.x.zip#egg=django +deps16 = + https://github.com/django/django/archive/stable/1.6.x.zip#egg=django +deps17 = + https://github.com/django/django/archive/master.zip#egg=django + +commands = + python manage.py test -v2 {posargs:tests} + + +[testenv:flake827] +basepython = python2.7 +deps = flake8 +commands = flake8 configurations --ignore=E501,E127,E128,E124 + +[testenv:flake833] +basepython = python3.3 +deps = flake8 +commands = flake8 configurations --ignore=E501,E127,E128,E124 + + +[testenv:py26-1.4.x] +basepython = python2.6 +deps = + {[testenv]deps} + {[testenv]deps14} + +[testenv:py26-1.5.x] +basepython = python2.6 +deps = + {[testenv]deps} + {[testenv]deps15} + +[testenv:py26-1.6.x] +basepython = python2.6 +deps = + {[testenv]deps} + {[testenv]deps16} + +[testenv:py26-1.7.x] +basepython = python2.6 +deps = + {[testenv]deps} + {[testenv]deps17} + +[testenv:py27-1.4.x] +basepython = python2.7 +deps = + {[testenv]deps} + {[testenv]deps14} + +[testenv:py27-1.5.x] +basepython = python2.7 +deps = + {[testenv]deps} + {[testenv]deps15} + +[testenv:py27-1.6.x] +basepython = python2.7 +deps = + {[testenv]deps} + {[testenv]deps16} + +[testenv:py27-1.7.x] +basepython = python2.7 +deps = + {[testenv]deps} + {[testenv]deps17} + +[testenv:py32-1.5.x] +basepython = python3.2 +deps = + {[testenv]deps} + {[testenv]deps15} + +[testenv:py32-1.6.x] +basepython = python3.2 +deps = + {[testenv]deps} + {[testenv]deps16} + +[testenv:py32-1.7.x] +basepython = python3.2 +deps = + {[testenv]deps} + {[testenv]deps17} + +[testenv:py33-1.5.x] +basepython = python3.3 +deps = + {[testenv]deps} + {[testenv]deps15} + +[testenv:py33-1.6.x] +basepython = python3.3 +deps = + {[testenv]deps} + {[testenv]deps16} + +[testenv:py33-1.7.x] +basepython = python3.3 +deps = + {[testenv]deps} + {[testenv]deps17} + +[testenv:pypy-1.4.x] +basepython = pypy +deps = + {[testenv]deps} + {[testenv]deps14} + +[testenv:pypy-1.5.x] +basepython = pypy +deps = + {[testenv]deps} + {[testenv]deps15} + +[testenv:pypy-1.6.x] +basepython = pypy +deps = + {[testenv]deps} + {[testenv]deps16} + +[testenv:pypy-1.7.x] +basepython = pypy +deps = + {[testenv]deps} + {[testenv]deps17}