From 77e0a4f9cf8ccc4654afa4ef769fb1c5e4c12133 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Thu, 11 Jul 2024 15:50:21 -0400 Subject: [PATCH] test.util: Remove our private compatibility shim for subTests --- tornado/test/options_test.py | 3 +-- tornado/test/util.py | 12 ------------ 2 files changed, 1 insertion(+), 14 deletions(-) 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.""" -- 2.47.2