if setuptools is not None:
# If setuptools is not available, you're on your own for dependencies.
install_requires = []
- if sys.version_info < (2, 7):
- # Only needed indirectly, for singledispatch.
- install_requires.append('ordereddict')
if sys.version_info < (3, 4):
install_requires.append('singledispatch')
if sys.version_info < (3, 5):
# 2.7 and 3.2
warnings.filterwarnings("ignore", category=DeprecationWarning,
message="Please use assert.* instead")
- # unittest2 0.6 on py26 reports these as PendingDeprecationWarnings
- # instead of DeprecationWarnings.
- warnings.filterwarnings("ignore", category=PendingDeprecationWarning,
- message="Please use assert.* instead")
# Twisted 15.0.0 triggers some warnings on py3 with -bb.
warnings.filterwarnings("ignore", category=BytesWarning,
module=r"twisted\..*")
skipIfNoTwisted = unittest.skipUnless(have_twisted,
"twisted module not present")
-skipIfPy26 = unittest.skipIf(sys.version_info < (2, 7),
- "twisted incompatible with singledispatch in py26")
-
def save_signal_handlers():
saved = {}
'http://127.0.0.1:%d' % self.tornado_port, self.run_reactor)
self.assertEqual(response, 'Hello from tornado!')
- @skipIfPy26
def testTornadoServerTwistedCoroutineClientIOLoop(self):
self.start_tornado_server()
response = self.twisted_coroutine_fetch(
@skipIfNoTwisted
-@skipIfPy26
class ConvertDeferredTest(unittest.TestCase):
def test_success(self):
@inlineCallbacks
from tornado.testing import bind_unused_port
-# Encapsulate the choice of unittest or unittest2 here.
-# To be used as 'from tornado.test.util import unittest'.
-if sys.version_info < (2, 7):
- # In py26, we must always use unittest2.
- import unittest2 as unittest # type: ignore
-else:
- # Otherwise, use whichever version of unittest was imported in
- # tornado.testing.
- from tornado.testing import unittest
+# Delegate the choice of unittest or unittest2 to tornado.testing.
+from tornado.testing import unittest
skipIfNonUnix = unittest.skipIf(os.name != 'posix' or sys.platform == 'cygwin',
"non-unix platform")