diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-05-08 15:12:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-08 15:12:19 (GMT) |
commit | c63c8ac2389d715c761f56bfcf17a685b62a0bd3 (patch) | |
tree | 5b4e82a1f54099f9a75217ac0045aa071dcf4188 /Lib/distutils | |
parent | a85bdd7e025f8b87b88d914f4df8f0b620398ea9 (diff) | |
download | cpython-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/distutils')
-rw-r--r-- | Lib/distutils/tests/test_build_ext.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py index 031897b..4ebeafe 100644 --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -41,9 +41,7 @@ class BuildExtTestCase(TempdirManager, # bpo-30132: On Windows, a .pdb file may be created in the current # working directory. Create a temporary working directory to cleanup # everything at the end of the test. - change_cwd = os_helper.change_cwd(self.tmp_dir) - change_cwd.__enter__() - self.addCleanup(change_cwd.__exit__, None, None, None) + self.enterContext(os_helper.change_cwd(self.tmp_dir)) def tearDown(self): import site |