]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
test.util: Remove our private compatibility shim for subTests 3414/head
authorBen Darnell <ben@bendarnell.com>
Thu, 11 Jul 2024 19:50:21 +0000 (15:50 -0400)
committerBen Darnell <ben@bendarnell.com>
Thu, 11 Jul 2024 19:50:21 +0000 (15:50 -0400)
tornado/test/options_test.py
tornado/test/util.py

index 99c3c12c80bb2cc65fe72d2ad947af789b2f318d..67d89c250eaae5d1e083f784e203e8224c04ca3f 100644 (file)
@@ -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:
index ed5fd5d3f6f1834b595ef4289499540f6d2cdb02..25dd2000fd5ce06555e24fc035374d6abb670d89 100644 (file)
@@ -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."""