summaryrefslogtreecommitdiffstats
path: root/Lib/test/test__osx_support.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-05-08 15:12:19 (GMT)
committerGitHub <noreply@github.com>2022-05-08 15:12:19 (GMT)
commitc63c8ac2389d715c761f56bfcf17a685b62a0bd3 (patch)
tree5b4e82a1f54099f9a75217ac0045aa071dcf4188 /Lib/test/test__osx_support.py
parenta85bdd7e025f8b87b88d914f4df8f0b620398ea9 (diff)
downloadcpython-c63c8ac2389d715c761f56bfcf17a685b62a0bd3.zip
cpython-c63c8ac2389d715c761f56bfcf17a685b62a0bd3.tar.gz
cpython-c63c8ac2389d715c761f56bfcf17a685b62a0bd3.tar.bz2
bpo-45046: Support context managers in unittest (GH-28045)
Add methods enterContext() and enterClassContext() in TestCase. Add method enterAsyncContext() in IsolatedAsyncioTestCase. Add function enterModuleContext(). (cherry picked from commit 086c6b1b0fe8d47ebd15512d7bdcb64c60a360f0) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test/test__osx_support.py')
-rw-r--r--Lib/test/test__osx_support.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/test/test__osx_support.py b/Lib/test/test__osx_support.py
index 907ae27..4a14cb3 100644
--- a/Lib/test/test__osx_support.py
+++ b/Lib/test/test__osx_support.py
@@ -19,8 +19,7 @@ class Test_OSXSupport(unittest.TestCase):
self.maxDiff = None
self.prog_name = 'bogus_program_xxxx'
self.temp_path_dir = os.path.abspath(os.getcwd())
- self.env = os_helper.EnvironmentVarGuard()
- self.addCleanup(self.env.__exit__)
+ self.env = self.enterContext(os_helper.EnvironmentVarGuard())
for cv in ('CFLAGS', 'LDFLAGS', 'CPPFLAGS',
'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'CC',
'CXX', 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS',