diff options
author | Bénédikt Tran <10796600+picnixz@users.noreply.github.com> | 2025-03-16 14:09:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-16 14:09:33 +0100 |
commit | 3185e3115c918ec189e16cf9f5b51a13a0146556 (patch) | |
tree | 4a773847ee275359ae58832afea1071858e539af /Lib/test/test_shutil.py | |
parent | 9558d22ac308c102e4f843541eead2022050225e (diff) | |
download | cpython-3185e3115c918ec189e16cf9f5b51a13a0146556.tar.gz cpython-3185e3115c918ec189e16cf9f5b51a13a0146556.zip |
gh-131277: allow `EnvironmentVarGuard` to unset more than one environment variable at once (#131280)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r-- | Lib/test/test_shutil.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 86bdc302ea7..ed01163074a 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -2458,7 +2458,7 @@ class TestWhich(BaseTest, unittest.TestCase): def test_environ_path_missing(self): with os_helper.EnvironmentVarGuard() as env: - env.pop('PATH', None) + del env['PATH'] # without confstr with unittest.mock.patch('os.confstr', side_effect=ValueError, \ @@ -2484,7 +2484,7 @@ class TestWhich(BaseTest, unittest.TestCase): def test_empty_path_no_PATH(self): with os_helper.EnvironmentVarGuard() as env: - env.pop('PATH', None) + del env['PATH'] rv = shutil.which(self.file) self.assertIsNone(rv) @@ -3446,8 +3446,7 @@ class TestGetTerminalSize(unittest.TestCase): expected = (int(size[1]), int(size[0])) # reversed order with os_helper.EnvironmentVarGuard() as env: - del env['LINES'] - del env['COLUMNS'] + env.unset('LINES', 'COLUMNS') actual = shutil.get_terminal_size() self.assertEqual(expected, actual) @@ -3455,8 +3454,7 @@ class TestGetTerminalSize(unittest.TestCase): @unittest.skipIf(support.is_wasi, "WASI has no /dev/null") def test_fallback(self): with os_helper.EnvironmentVarGuard() as env: - del env['LINES'] - del env['COLUMNS'] + env.unset('LINES', 'COLUMNS') # sys.__stdout__ has no fileno() with support.swap_attr(sys, '__stdout__', None): |