From: Ben Darnell Date: Thu, 11 Jul 2024 19:50:21 +0000 (-0400) Subject: test.util: Remove our private compatibility shim for subTests X-Git-Tag: v6.5.0b1~39^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3414%2Fhead;p=thirdparty%2Ftornado.git test.util: Remove our private compatibility shim for subTests --- diff --git a/tornado/test/options_test.py b/tornado/test/options_test.py index 99c3c12c..67d89c25 100644 --- a/tornado/test/options_test.py +++ b/tornado/test/options_test.py @@ -7,7 +7,6 @@ import unittest from tornado.options import OptionParser, Error from tornado.util import basestring_type -from tornado.test.util import subTest import typing @@ -277,7 +276,7 @@ class OptionsTest(unittest.TestCase): ("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: diff --git a/tornado/test/util.py b/tornado/test/util.py index ed5fd5d3..25dd2000 100644 --- a/tornado/test/util.py +++ b/tornado/test/util.py @@ -80,18 +80,6 @@ def exec_test(caller_globals, caller_locals, s): 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."""