From 6d71106c3c6a8924f75e5058cd6c54e765af3b94 Mon Sep 17 00:00:00 2001 From: Maik Hoepfel Date: Tue, 31 Jan 2017 02:25:07 +0100 Subject: [PATCH] Simplify testing infrastructure (#515) * Mark runtests helper executable * Bump required version of asgiref We're probably making our life easier when we keep the Channels dependencies roughly in sync. As a 1.0 release was made, I suggest to require it. * Simplify tox and Travis configuration I hopefully simplified the tox configuration by following what I did in the other four Channels projects. I then had a good look at tox-travis and decided to remove it. It does add a layer of indirection with, IMHO, not enough gain. To understand what Travis is doing, one would need to consider two files (and understand tox-travis) instead of just one file. It also introduces another point of failure. What pushed me over was that there's a bug with env matching (https://github.com/ryanhiebert/tox-travis/issues/55) and tox or tox-travis seem to mask an Exception (https://travis-ci.org/django/channels/jobs/195950971#L195) that would be hard to debug. The draw back is that we duplicate the Django dependency matrix, and the commands that are executed in Travis and tox. We could add a "--with-qa" flag to runtests.py to have it execute flake8 and isort to rectify the latter. I extracted test dependencies as I did for asgi_redis. * Document supported versions --- .travis.yml | 18 ++++++++++++++++-- README.rst | 6 ++++++ runtests.py | 0 setup.py | 5 ++++- tox.ini | 23 +++-------------------- 5 files changed, 29 insertions(+), 23 deletions(-) mode change 100644 => 100755 runtests.py diff --git a/.travis.yml b/.travis.yml index 3e7de1d..3886439 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,22 @@ sudo: false + language: python + python: - "2.7" - "3.4" - "3.5" -install: pip install tox-travis -script: tox + +env: + - DJANGO="Django>=1.8,<1.9" + - DJANGO="Django>=1.9,<1.10" + - DJANGO="Django>=1.10,<1.11" + +install: + - pip install $DJANGO -e .[tests] + - pip freeze + +script: + - python runtests.py + - flake8 + - isort --check-only --recursive channels diff --git a/README.rst b/README.rst index 2ca9a71..5d1877f 100644 --- a/README.rst +++ b/README.rst @@ -33,6 +33,12 @@ You'll likely also want to ``asgi_redis`` to provide the Redis channel layer. See our `installation `_ and `getting started `_ docs for more. +Dependencies +------------ + +All Channels projects currently support Python 2.7, 3.4 and 3.5. `channels` supports all released +Django versions, namely 1.8-1.10. + Contributing ------------ diff --git a/runtests.py b/runtests.py old mode 100644 new mode 100755 diff --git a/setup.py b/setup.py index ac0567f..e69f558 100644 --- a/setup.py +++ b/setup.py @@ -13,9 +13,12 @@ setup( include_package_data=True, install_requires=[ 'Django>=1.8', - 'asgiref>=0.13', + 'asgiref>=1.0.0', 'daphne>=1.0.0', ], + extras_require={ + 'tests': ['coverage', 'mock', 'tox', 'flake8>=2.0,<3.0', 'isort'] + }, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', diff --git a/tox.ini b/tox.ini index 8b95ac3..1937445 100644 --- a/tox.ini +++ b/tox.ini @@ -1,33 +1,16 @@ [tox] -skipsdist = True envlist = - {py27}-django-{18,19,110} - {py34}-django-{18,19,110} - {py35}-django-{18,19,110} + {py27,34,35}-django-{18,19,110} {py27,py35}-flake8 isort -[tox:travis] -2.7 = py27, isort - [testenv] -setenv = - PYTHONPATH = {toxinidir}:{toxinidir} +extras = tests deps = - autobahn - coverage - daphne - asgiref>=0.9 - six - redis==2.10.5 - py27: mock - flake8: flake8>=2.0,<3.0 - isort: isort django-18: Django>=1.8,<1.9 django-19: Django>=1.9,<1.10 django-110: Django>=1.10,<1.11 commands = flake8: flake8 - isort: isort -c -rc channels + isort: isort --check-only --recursive channels django: coverage run --parallel-mode {toxinidir}/runtests.py -