# Encapsulate the choice of unittest or unittest2 here.
# To be used as 'from tornado.test.util import unittest'.
-if sys.version_info >= (2, 7):
- import unittest
-else:
+if sys.version_info < (2, 7):
+ # In py26, we must always use unittest2.
import unittest2 as unittest
+else:
+ # Otherwise, use whichever version of unittest was imported in
+ # tornado.testing.
+ from tornado.testing import unittest
skipIfNonUnix = unittest.skipIf(os.name != 'posix' or sys.platform == 'cygwin',
"non-unix platform")
# (either py27+ or unittest2) so tornado.test.util enforces
# this requirement, but for other users of tornado.testing we want
# to allow the older version if unitest2 is not available.
-try:
- import unittest2 as unittest
-except ImportError:
+if sys.version_info >= (3,):
+ # On python 3, mixing unittest2 and unittest (including doctest)
+ # doesn't seem to work, so always use unittest.
import unittest
+else:
+ # On python 2, prefer unittest2 when available.
+ try:
+ import unittest2 as unittest
+ except ImportError:
+ import unittest
_next_port = 10000
py2-opt, py3-opt,
py3-utf8,
py2-locale,
+ py27-unittest2, py33-unittest2,
# Ensure the sphinx build has no errors or warnings
py2-docs
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.
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