aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-05-08 17:49:09 +0300
committerGitHub <noreply@github.com>2022-05-08 17:49:09 +0300
commit086c6b1b0fe8d47ebd15512d7bdcb64c60a360f0 (patch)
treea7b1eaf75879c3fded1b946b2331f6a45dfc8fc7 /Lib/test/test_logging.py
parent8f293180791f2836570bdfc29aadba04a538d435 (diff)
downloadcpython-086c6b1b0fe8d47ebd15512d7bdcb64c60a360f0.tar.gz
cpython-086c6b1b0fe8d47ebd15512d7bdcb64c60a360f0.zip
bpo-45046: Support context managers in unittest (GH-28045)
Add methods enterContext() and enterClassContext() in TestCase. Add method enterAsyncContext() in IsolatedAsyncioTestCase. Add function enterModuleContext().
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r--Lib/test/test_logging.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 5d4ddedd059..e69afae484a 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -5650,9 +5650,7 @@ class MiscTestCase(unittest.TestCase):
# why the test does this, but in any case we save the current locale
# first and restore it at the end.
def setUpModule():
- cm = support.run_with_locale('LC_ALL', '')
- cm.__enter__()
- unittest.addModuleCleanup(cm.__exit__, None, None, None)
+ unittest.enterModuleContext(support.run_with_locale('LC_ALL', ''))
if __name__ == "__main__":