From: Ben Darnell Date: Sat, 11 Oct 2014 14:39:39 +0000 (-0400) Subject: Streamline tox configuration using new features in tox 1.8. X-Git-Tag: v4.1.0b1~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea943e325a8b8e3904093dbfe1c9feed08dfda15;p=thirdparty%2Ftornado.git Streamline tox configuration using new features in tox 1.8. --- diff --git a/tox.ini b/tox.ini index 0004dd5fd..7d9197c9a 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,8 @@ # test suite on all supported python versions. To use it, "pip install tox" # and then run "tox" from this directory. # +# This configuration requires tox 1.8 or higher. +# # Installation tips: # When building pycurl on my macports-based setup, I need to either set the # environment variable ARCHFLAGS='-arch x86_64' or use @@ -12,42 +14,116 @@ 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, - py34, py34-full, - pypy, pypy-full, - pypy3, + # (pypy3 doesn't have any optional deps yet) + {py26,py27,pypy,py32,py33,py34,pypy3}, + {py26,py27,pypy,py32,py33,py34}-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). + # py2 and py3 are aliases for py27-full and py34-full. # Alternate HTTP clients. - py2-curl, py3-curl, + {py2,py3}-curl, # Alternate IOLoops. - py2-select, py3-select, - py2-twisted, py26-twisted, py3-twisted, py2-twistedlayered, - py3-asyncio, py33-asyncio, py26-trollius, py2-trollius, + {py2,py3}-select, + {py2,py26,py3}-full-twisted, + py2-twistedlayered, + {py3,py33}-asyncio, + {py26,py2}-trollius, # Alternate Resolvers. - py2-caresresolver, py3-caresresolver, - py2-threadedresolver, py3-threadedresolver, + {py2,py3}-full-{threadedresolver}, + {py2,py32}-full-caresresolver, # Other configurations; see comments below. - py2-monotonic, py3-monotonic, - py2-opt, py3-opt, - py3-utf8, + {py2,py3}-{monotonic,opt}, + py3-{lang_c,lang_utf8}, py2-locale, - py27-unittest2, py33-unittest2, + {py27,py3}-unittest2, # Ensure the sphinx build has no errors or warnings - py-docs + py3-docs [testenv] -commands = python -m tornado.test.runtests {posargs:} +# Most of these are defaults, but if you specify any you can't fall back +# defaults for the others. +basepython = + py26: python2.6 + py27: python2.7 + py32: python3.2 + py33: python3.3 + py34: python3.4 + pypy: pypy + pypy3: pypy3 + py2: python2.7 + py3: python3.4 + +deps = + # unittest2 is a hard requirement on py26. + py26: unittest2 + # unittest2 doesn't add anything we need on 2.7+, but we should ensure that + # its existence doesn't break anything due to conditional imports. + py27-unittest2: unittest2 + py3-unittest2: unittest2py3k + # cpython-only deps: pycurl installs but curl_httpclient doesn't work; + # twisted mostly works but is a bit flaky under pypy. + {py26,py27,py32,py33,py34}-full: pycurl + {py2,py3}: pycurl==7.19.3.1 + # twisted is cpython only and doesn't support py32. + {py26,py27,py33,py34}-full: twisted + {py2,py3}: twisted + # pycares installation currently fails on py33 + # (https://github.com/pypa/pip/pull/816) + {py2,py26,py27,py32}-full: pycares + # futures became standard in py32 + {py2,py26,py27,pypy}-full: futures + # mock became standard in py33 + {py2,py26,py27,pypy,py3,py32,pypy3}-full: mock + py33-asyncio: asyncio + trollius: trollius + py2-monotonic: Monotime + +setenv = + # The extension is mandatory on cpython. + {py2,py26,py27,py3,py32,py33,py34}: TORNADO_EXTENSION=1 + # 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. + lang_c: LANG=C + lang_utf8: LANG=en_US.utf-8 + # tox's parser chokes if all the setenv entries are conditional. + DUMMY=dummy + +# All non-comment lines but the last must end in a backslash. +# Tox filters line-by-line based on the environment name. +commands = + python \ + # py3*: -b turns on an extra warning when calling + # str(bytes), and -bb makes it an error. + {py32,py33,py34,pypy3}: -bb \ + # 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. + opt: -O \ + -m tornado.test.runtests \ + # Note that httpclient_test is always run with both client + # implementations; this flag controls which client all the + # other tests use. + curl: --httpclient=tornado.curl_httpclient.CurlAsyncHTTPClient \ + select: --ioloop=tornado.platform.select.SelectIOLoop \ + twisted: --ioloop=tornado.platform.twisted.TwistedIOLoop \ + twistedlayered: --ioloop=tornado.test.twisted_test.LayeredTwistedIOLoop --resolver=tornado.platform.twisted.TwistedResolver \ + {asyncio,trollius}: --ioloop=tornado.platform.asyncio.AsyncIOLoop \ + caresresolver: --resolver=tornado.platform.caresresolver.CaresResolver \ + threadedresolver: --resolver=tornado.netutil.ThreadedResolver \ + monotonic: --ioloop_time_monotonic \ + # Test with a non-english locale to uncover str/bytes mixing issues. + locale: --locale=zh_TW \ + {posargs:} # python will import relative to the current working directory by default, # so cd into the tox working directory to avoid picking up the working @@ -59,232 +135,11 @@ changedir = {toxworkdir} # Remove it (it's not a part of {opts}) to only install real releases. install_command = pip install {opts} {packages} -[testenv:py26] -basepython = python2.6 -deps = unittest2 - -[testenv:py26-full] -basepython = python2.6 -setenv = TORNADO_EXTENSION=1 -deps = - {[testenv:py26]deps} - futures - mock - pycares - pycurl - twisted>=11.0.0 - -[testenv:py27-full] -basepython = python2.7 -setenv = TORNADO_EXTENSION=1 -deps = - futures - mock - pycares - pycurl - twisted>=11.0.0 - -# unittest2 doesn't add anything we need on 2.7, but we should ensure that -# its existence doesn't break anything due to conditional imports. -[testenv:py27-unittest2] -basepython = python2.7 -deps = unittest2 - -# 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 -setenv = TORNADO_EXTENSION=1 -deps = - mock - pycares - pycurl>=7.19.3 - -[testenv:py33-full] -basepython = python3.3 -setenv = TORNADO_EXTENSION=1 -# pycares installation currently fails on py33 -# (https://github.com/pypa/pip/pull/816) -deps = - pycurl>=7.19.3 - -# See comment on py27-unittest2. -[testenv:py33-unittest2] -basepython = python3.3 -setenv = TORNADO_EXTENSION=1 -deps = unittest2py3k - -[testenv:py34-full] -basepython = python3.4 -setenv = TORNADO_EXTENSION=1 -# pycares installation currently fails on py34 -# (https://github.com/pypa/pip/pull/816) -deps = - Twisted>=14.0.0 - pycurl>=7.19.3 - -[testenv:pypy-full] -# This configuration works with pypy 1.9. pycurl installs ok but -# curl_httpclient doesn't work. pycares also installs but 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:pypy3] -basepython = pypy3 - -[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 = {[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: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 = {[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 = {[testenv:py26-full]deps} -commands = python -m tornado.test.runtests --ioloop=tornado.platform.twisted.TwistedIOLoop {posargs:} - -[testenv:py3-twisted] -basepython = python3.4 -deps = {[testenv:py34-full]deps} -commands = python -m tornado.test.runtests --ioloop=tornado.platform.twisted.TwistedIOLoop {posargs:} - -[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:py3-asyncio] -basepython = python3.4 -deps = {[testenv:py34-full]deps} -commands = python -m tornado.test.runtests --ioloop=tornado.platform.asyncio.AsyncIOLoop {posargs:} - -[testenv:py33-asyncio] -basepython = python3.3 -deps = - {[testenv:py33-full]deps} - asyncio -commands = python -m tornado.test.runtests --ioloop=tornado.platform.asyncio.AsyncIOLoop {posargs:} - -# Trollius is the py2 backport of asyncio. -[testenv:py2-trollius] -basepython = python2.7 -deps = - {[testenv:py27-full]deps} - trollius>=0.1.1 -commands = python -m tornado.test.runtests --ioloop=tornado.platform.asyncio.AsyncIOLoop {posargs:} - -[testenv:py26-trollius] -basepython = python2.6 -deps = - {[testenv:py26-full]deps} - trollius>=0.1.3 -commands = python -m tornado.test.runtests --ioloop=tornado.platform.asyncio.AsyncIOLoop {posargs:} - -[testenv:py2-caresresolver] -basepython = python2.7 -deps = {[testenv:py27-full]deps} -commands = python -m tornado.test.runtests --resolver=tornado.platform.caresresolver.CaresResolver {posargs:} - -[testenv:py3-caresresolver] -# pycares does not install on python 3.3+ -basepython = python3.2 -deps = {[testenv:py32-full]deps} -commands = python -m tornado.test.runtests --resolver=tornado.platform.caresresolver.CaresResolver {posargs:} - -[testenv:py2-threadedresolver] -basepython = python2.7 -deps = {[testenv:py27-full]deps} -commands = python -m tornado.test.runtests --resolver=tornado.netutil.ThreadedResolver {posargs:} - -[testenv:py3-threadedresolver] -basepython = python3.4 -deps = {[testenv:py34-full]deps} -commands = python -m tornado.test.runtests --resolver=tornado.netutil.ThreadedResolver {posargs:} - -[testenv:py2-monotonic] -basepython = python2.7 -deps = - {[testenv:py27-full]deps} - Monotime -commands = python -m tornado.test.runtests --ioloop_time_monotonic {posargs:} - -# Note that this test only works in py33+ (the Monotime backport package is -# only for 2.x) -[testenv:py3-monotonic] -basepython = python3.3 -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:py2-opt] -basepython = python2.7 -deps = {[testenv:py27-full]deps} -commands = python -O -m tornado.test.runtests {posargs:} - -[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 --locale=zh_TW {posargs:} - -[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:py-docs] -basepython = python3 +[testenv:py3-docs] changedir = docs +# For some reason the extension fails to load in this configuration, +# but it's not really needed for docs anyway. +setenv = TORNADO_EXTENSION=0 deps = sphinx==1.2.2 sphinx_rtd_theme