From: Ben Darnell Date: Wed, 15 Jan 2014 04:16:26 +0000 (-0500) Subject: Refactor the unwieldy tox.ini file. X-Git-Tag: v4.0.0b1~151 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a9194f7f31d7a290b887c02a949c0d9ea5dbd7c;p=thirdparty%2Ftornado.git Refactor the unwieldy tox.ini file. Fill in some gaps in the coverage (mostly on the python 3 side, and using more consistent dependencies throughout) and move the 3.x tests that don't care about a specific 3.x version to 3.3. This is still less thorough than the travis.yml, which runs everything for every python version. --- diff --git a/tox.ini b/tox.ini index f8ae53fab..bc0377753 100644 --- a/tox.ini +++ b/tox.ini @@ -3,14 +3,46 @@ # test suite on all supported python versions. To use it, "pip install tox" # and then run "tox" from this directory. # +# Installation tips: # When building pycurl on my macports-based setup, I need to either set the # environment variable ARCHFLAGS='-arch x86_64' or use # 'port install curl +universal' to get both 32- and 64-bit versions of # libcurl. [tox] -# "-full" variants include optional dependencies, to ensure -# that things work both in a bare install and with all the extras. -envlist = py27-full, py27-curl, py32-full, pypy, py32-curl, py26, py26-full, py27, py32, py32-utf8, py33, py27-opt, py32-opt, pypy-full, py27-select, py27-monotonic, py33-monotonic, py33-asyncio, py27-twisted, py27-threadedresolver, py27-twistedresolver, py27-twistedlayered, py27-caresresolver, py32-caresresolver, py27-locale, py27-trollius, py27-docs +envlist = + # Basic configurations: Run the tests in both minimal installations + # and with all optional dependencies. + py26, py26-full, + py27, py27-full, + py32, py32-full, + py33, py33-full, + pypy, pypy-full, + + # Also run the tests with each possible replacement of a default + # component. Run each test on both python 2 and 3 where possible. + # (Only one 2.x and one 3.x unless there are known differences). + + # Alternate HTTP clients. + py2-curl, py3-curl, + + # Alternate IOLoops. + py2-select, py3-select, + py2-twisted, py26-twisted, py2-twistedlayered, + py33-asyncio, py2-trollius, + + # Alternate resolvers. + py2-threadedresolver, py3-threadedresolver, + py2-twistedresolver, + py2-caresresolver, py32-caresresolver, + + # Other configurations; see comments below. + py2-monotonic, py3-monotonic, + py2-opt, py3-opt, + py3-utf8, + py2-locale, + + # Ensure the sphinx build has no errors or warnings + py2-docs [testenv] commands = python -m tornado.test.runtests {posargs:} @@ -19,10 +51,6 @@ commands = python -m tornado.test.runtests {posargs:} # so cd into the tox working directory to avoid picking up the working # copy of the files (especially important for 2to3). changedir = {toxworkdir} -# Note that PYTHONPATH must not be set when running tox (and setting it -# with the following doesn't seem to work, since tox/virtualenv appends to -# PYTHONPATH) -#environment = PYTHONPATH= # tox 1.6 passes --pre to pip by default, which currently has problems # installing pycurl and monotime (https://github.com/pypa/pip/issues/1405). @@ -36,11 +64,11 @@ deps = unittest2 [testenv:py26-full] basepython = python2.6 deps = + {[testenv:py26]deps} futures mock pycurl twisted>=11.0.0 - unittest2 [testenv:py27-full] basepython = python2.7 @@ -50,191 +78,174 @@ deps = pycurl twisted>=11.0.0 -[testenv:py27-curl] +# In python 3, opening files in text mode uses a system-dependent encoding by +# default. Run the tests with "C" (ascii) and "utf-8" locales to ensure +# we don't have hidden dependencies on this setting. +[testenv:py32] +basepython = python3.2 +setenv = LANG=C +# -b turns on an extra warning when calling str(bytes), and -bb makes +# it an error. +commands = python -bb -m tornado.test.runtests {posargs:} + +[testenv:py32-full] +basepython = python3.2 +deps = + mock + pycurl>=7.19.3 + +[testenv:py33-full] +basepython = python3.3 +deps = + pycurl>=7.19.3 + +[testenv:pypy-full] +# This configuration works with pypy 1.9. pycurl installs ok but +# curl_httpclient doesn't work. Twisted works most of the time, but +# its tests seem flaky under pypy, so we don't run it for now. Also +# note that travis-ci does not yet have support for building C +# extensions with pypy, so we don't try to run this configuration +# there. +basepython = pypy +deps = + futures + mock + +[testenv:py2-curl] # Same as py27-full, but runs the tests with curl_httpclient by default. # Note that httpclient_test is always run with both client implementations; # this flag controls which client all the other tests use. basepython = python2.7 -deps = - futures - mock - pycurl - twisted>=11.0.0 +deps = {[testenv:py27-full]deps} +commands = python -m tornado.test.runtests --httpclient=tornado.curl_httpclient.CurlAsyncHTTPClient {posargs:} + +[testenv:py3-curl] +basepython = python3.3 +deps = {[testenv:py33-full]deps} commands = python -m tornado.test.runtests --httpclient=tornado.curl_httpclient.CurlAsyncHTTPClient {posargs:} -[testenv:py27-select] +[testenv:py2-select] # Same as py27-full, but runs the tests with the select IOLoop. # The other tests will run with the most platform-appropriate implementation, # but this one is the lowest common denominator and should work anywhere. basepython = python2.7 -deps = - futures - mock - pycurl - twisted>=11.0.0 +deps = {[testenv:py27-full]deps} commands = python -m tornado.test.runtests --ioloop=tornado.platform.select.SelectIOLoop {posargs:} +[testenv:py3-select] +basepython = python3.3 +deps = {[testenv:py33-full]deps} +commands = python -m tornado.test.runtests --ioloop=tornado.platform.select.SelectIOLoop {posargs:} + +[testenv:py2-twisted] +basepython = python2.7 +deps = {[testenv:py27-full]deps} +commands = python -m tornado.test.runtests --ioloop=tornado.platform.twisted.TwistedIOLoop {posargs:} + [testenv:py26-twisted] basepython = python2.6 -deps = - futures - mock - pycurl - twisted>=12.3.0 - unittest2 +deps = {[testenv:py26-full]deps} commands = python -m tornado.test.runtests --ioloop=tornado.platform.twisted.TwistedIOLoop {posargs:} -[testenv:py27-twisted] +[testenv:py2-twistedlayered] basepython = python2.7 +deps = {[testenv:py27-full]deps} +commands = python -m tornado.test.runtests --ioloop=tornado.test.twisted_test.LayeredTwistedIOLoop --resolver=tornado.platform.twisted.TwistedResolver {posargs:} + +[testenv:py33-asyncio] +basepython = python3.3 +# Pycurl tests currently fail with asyncio. deps = - futures - mock - pycurl - twisted>=12.3.0 -commands = python -m tornado.test.runtests --ioloop=tornado.platform.twisted.TwistedIOLoop {posargs:} + asyncio + # pycurl +commands = python -m tornado.test.runtests --ioloop=tornado.platform.asyncio.AsyncIOLoop {posargs:} -[testenv:py27-monotonic] +# Trollius is the py2.7 backport of asyncio. +[testenv:py2-trollius] basepython = python2.7 +# Pycurl tests currently fail with trollius. deps = - Monotime futures mock - pycurl + # pycurl + trollius>=0.1.1 twisted -commands = python -m tornado.test.runtests --ioloop_time_monotonic {posargs:} +commands = python -m tornado.test.runtests --ioloop=tornado.platform.asyncio.AsyncIOLoop {posargs:} -[testenv:py27-threadedresolver] +[testenv:py2-threadedresolver] basepython = python2.7 -deps = - futures - mock - pycurl - twisted +deps = {[testenv:py27-full]deps} commands = python -m tornado.test.runtests --resolver=tornado.netutil.ThreadedResolver {posargs:} -[testenv:py27-twistedresolver] -basepython = python2.7 -deps = - futures - mock - pycurl - twisted -commands = python -m tornado.test.runtests --resolver=tornado.platform.twisted.TwistedResolver {posargs:} +[testenv:py3-threadedresolver] +basepython = python3.3 +deps = {[testenv:py33-full]deps} +commands = python -m tornado.test.runtests --resolver=tornado.netutil.ThreadedResolver {posargs:} -[testenv:py27-twistedlayered] +[testenv:py2-twistedresolver] basepython = python2.7 -deps = - futures - mock - pycurl - twisted -commands = python -m tornado.test.runtests --ioloop=tornado.test.twisted_test.LayeredTwistedIOLoop --resolver=tornado.platform.twisted.TwistedResolver {posargs:} +deps = {[testenv:py27-full]deps} +commands = python -m tornado.test.runtests --resolver=tornado.platform.twisted.TwistedResolver {posargs:} -[testenv:py27-caresresolver] +[testenv:py2-caresresolver] basepython = python2.7 deps = - futures - mock + {[testenv:py27-full]deps} pycares - pycurl - twisted commands = python -m tornado.test.runtests --resolver=tornado.platform.caresresolver.CaresResolver {posargs:} -[testenv:py27-locale] -basepython = python2.7 -commands = python -m tornado.test.runtests --locale=zh_TW {posargs:} - -[testenv:pypy-full] -# This configuration works with pypy 1.9. pycurl installs ok but -# curl_httpclient doesn't work. Twisted works most of the time, but -# its tests seem flaky under pypy, so we don't run it for now. Also -# note that travis-ci does not yet have support for building C -# extensions with pypy, so we don't try to run this configuration -# there. -basepython = pypy -deps = - futures - mock - -# In python 3, opening files in text mode uses a system-dependent encoding by -# default. Run the tests with "C" (ascii) and "utf-8" locales to ensure -# we don't have hidden dependencies on this setting. -[testenv:py32] -basepython = python3.2 -setenv = LANG=C -# -b turns on an extra warning when calling str(bytes), and -bb makes -# it an error. -commands = python -bb -m tornado.test.runtests {posargs:} - -[testenv:py32-utf8] -basepython = python3.2 -setenv = LANG=en_US.utf-8 - -[testenv:py32-full] +# pycares installation currently fails on py33 +# (https://github.com/pypa/pip/pull/816) +[testenv:py32-caresresolver] basepython = python3.2 deps = - mock - pycurl>=7.19.3 + {[testenv:py32-full]deps} + pycares +commands = python -m tornado.test.runtests --resolver=tornado.platform.caresresolver.CaresResolver {posargs:} -[testenv:py32-curl] -basepython = python3.2 +[testenv:py2-monotonic] +basepython = python2.7 deps = - mock - pycurl>=7.19.3 -commands = python -m tornado.test.runtests --httpclient=tornado.curl_httpclient.CurlAsyncHTTPClient {posargs:} - -[testenv:py33] -# tox doesn't yet know "py33" by default -basepython = python3.3 - -[testenv:py33-monotonic] -basepython = python3.3 + {[testenv:py27-full]deps} + Monotime commands = python -m tornado.test.runtests --ioloop_time_monotonic {posargs:} -[testenv:py33-asyncio] +# Note that this test only works in py33+ (the Monotime backport package is +# only for 2.x) +[testenv:py3-monotonic] basepython = python3.3 -commands = python -m tornado.test.runtests --ioloop=tornado.platform.asyncio.AsyncIOLoop {posargs:} -deps = asyncio - -[testenv:py32-caresresolver] -basepython = python3.2 -deps = - pycares -commands = python -m tornado.test.runtests --resolver=tornado.platform.caresresolver.CaresResolver {posargs:} - +deps = {[testenv:py33-full]deps} +commands = python -m tornado.test.runtests --ioloop_time_monotonic {posargs:} # Python's optimized mode disables the assert statement, so run the # tests in this mode to ensure we haven't fallen into the trap of relying # on an assertion's side effects or using them for things that should be # runtime errors. -[testenv:py27-opt] +[testenv:py2-opt] basepython = python2.7 -deps = - futures - mock - pycurl - twisted>=12.0.0 +deps = {[testenv:py27-full]deps} commands = python -O -m tornado.test.runtests {posargs:} -# Trollius is the py2.7 backport of asyncio. -[testenv:py27-trollius] +[testenv:py3-opt] +basepython = python3.3 +deps = {[testenv:py33-full]deps} +commands = python -O -m tornado.test.runtests {posargs:} + +# Test with a non-english locale to uncover str/bytes mixing issues. +[testenv:py2-locale] basepython = python2.7 -commands = python -m tornado.test.runtests --ioloop=tornado.platform.asyncio.AsyncIOLoop {posargs:} -# Pycurl tests currently fail with trollius. -deps = - futures - mock - # pycurl - trollius>=0.1.1 - twisted +commands = python -m tornado.test.runtests --locale=zh_TW {posargs:} -[testenv:py32-opt] -basepython = python3.2 -commands = python -O -m tornado.test.runtests {posargs:} -deps = - mock +[testenv:py3-locale] +basepython = python3.3 +commands = python -m tornado.test.runtests --locale=zh_TW {posargs:} + +# This test is the counterpart to the LANG=C in testenv:py33. +[testenv:py3-utf8] +basepython = python3.3 +setenv = LANG=en_US.utf-8 -[testenv:py27-docs] +[testenv:py2-docs] basepython = python2.7 changedir = docs deps = sphinx