from tornado.options import OptionParser, Error
from tornado.util import basestring_type
-from tornado.test.util import subTest
import typing
("foo_bar", "foo-bar"),
]
for a, b in tests:
- with subTest(self, a=a, b=b):
+ with self.subTest(self, a=a, b=b):
options = OptionParser()
options.define(a)
with self.assertRaises(Error) as cm:
return local_namespace
-def subTest(test, *args, **kwargs):
- """Compatibility shim for unittest.TestCase.subTest.
-
- Usage: ``with tornado.test.util.subTest(self, x=x):``
- """
- try:
- subTest = test.subTest # py34+
- except AttributeError:
- subTest = contextlib.contextmanager(lambda *a, **kw: (yield))
- return subTest(*args, **kwargs)
-
-
@contextlib.contextmanager
def ignore_deprecation():
"""Context manager to ignore deprecation warnings."""