From 51ffbca62ad3d15d4eea71eb34b4872e554ee6ac Mon Sep 17 00:00:00 2001 From: Maik Hoepfel Date: Mon, 30 Jan 2017 15:39:16 +0100 Subject: [PATCH] Test against Python 3.4 and multiple Twisted versions This commit adds tox to be able to test against different dependencies locally. We agreed that Python 3.4 should be supported across all Channels projects, so it is also added with this commit. Furthermore, I think it makes sense to support a broad range of Twisted releases, as users of daphne are not unlikely to have other Twisted code running. It's not feasible to test against all releases since 16.0, and it would require constant maintenance to add new releases as they come out. So I opted to keep things simple for now, and only test against the oldest supported and the current Twisted release. I did consider @jpic's great idea from https://github.com/django/daphne/pull/19 to just use tox to avoid having to duplicate the dependency matrix. But it does lead to slower test runs as it bypasses Travis' caching, and is slightly more verbose. --- .gitignore | 1 + .travis.yml | 15 +++++++++++---- setup.py | 1 + tox.ini | 8 ++++++++ 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index bbe7d22..33dfc28 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ __pycache__ dist/ build/ +/.tox diff --git a/.travis.yml b/.travis.yml index 6f34248..5ee9ae1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,16 @@ sudo: false + language: python + python: - "2.7" + - "3.4" - "3.5" -install: - - if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install unittest2; fi - - pip install asgiref twisted autobahn -script: if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then python -m unittest2; else python -m unittest; fi + +env: + - TWISTED_RELEASE="twisted" + - TWISTED_RELEASE="twisted==16.0.0" + +install: pip install $TWISTED_RELEASE -e . + +script: python -m unittest discover diff --git a/setup.py b/setup.py index 462cece..d0e0a92 100755 --- a/setup.py +++ b/setup.py @@ -40,6 +40,7 @@ setup( 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Topic :: Internet :: WWW/HTTP', ], diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..7554262 --- /dev/null +++ b/tox.ini @@ -0,0 +1,8 @@ +# We test against the oldest supported Twisted release, and the current release. +[tox] +envlist = py{27,34,35}-twisted-{old,new} + +[testenv] +deps = + twisted-old: twisted==16.0.0 +commands = python -m unittest discover