mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
[3.13] gh-131277: allow EnvironmentVarGuard to unset more than one environment variable at once (GH-131280) (#131409)
(cherry picked from commit 3185e3115c
)
---------
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
parent
25ae2045a8
commit
85c20374c0
10 changed files with 27 additions and 36 deletions
|
@ -2465,7 +2465,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, \
|
||||
|
@ -2491,7 +2491,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)
|
||||
|
||||
|
@ -3424,8 +3424,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)
|
||||
|
@ -3433,8 +3432,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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue