diff options
Diffstat (limited to 'Lib/test/support/os_helper.py')
-rw-r--r-- | Lib/test/support/os_helper.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/support/os_helper.py b/Lib/test/support/os_helper.py index 15dcdc9b1fd..4e39b5a835a 100644 --- a/Lib/test/support/os_helper.py +++ b/Lib/test/support/os_helper.py @@ -720,9 +720,10 @@ else: class EnvironmentVarGuard(collections.abc.MutableMapping): + """Class to help protect the environment variable properly. - """Class to help protect the environment variable properly. Can be used as - a context manager.""" + Can be used as a context manager. + """ def __init__(self): self._environ = os.environ @@ -756,8 +757,10 @@ class EnvironmentVarGuard(collections.abc.MutableMapping): def set(self, envvar, value): self[envvar] = value - def unset(self, envvar): - del self[envvar] + def unset(self, envvar, /, *envvars): + """Unset one or more environment variables.""" + for ev in (envvar, *envvars): + del self[ev] def copy(self): # We do what os.environ.copy() does. |