diff options
| author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-10-18 09:28:26 (GMT) |
|---|---|---|
| committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-10-18 09:28:26 (GMT) |
| commit | 2b06d42db58e333ee932b5718ef2cb14b9ccfa91 (patch) | |
| tree | 833cd8df0a668f2b119545417755b81346c00ef6 /Lib/distutils/tests/support.py | |
| parent | 11abfe640fbfe37e7b5770ceebf21387e355951f (diff) | |
| download | cpython-2b06d42db58e333ee932b5718ef2cb14b9ccfa91.zip cpython-2b06d42db58e333ee932b5718ef2cb14b9ccfa91.tar.gz cpython-2b06d42db58e333ee932b5718ef2cb14b9ccfa91.tar.bz2 | |
Changed distutils tests to avoid environment alteration
Diffstat (limited to 'Lib/distutils/tests/support.py')
| -rw-r--r-- | Lib/distutils/tests/support.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Lib/distutils/tests/support.py b/Lib/distutils/tests/support.py index 3c328cc..41d3cd3 100644 --- a/Lib/distutils/tests/support.py +++ b/Lib/distutils/tests/support.py @@ -2,11 +2,11 @@ import os import shutil import tempfile +from copy import deepcopy from distutils import log from distutils.log import DEBUG, INFO, WARN, ERROR, FATAL from distutils.core import Distribution -from test.test_support import EnvironmentVarGuard class LoggingSilencer(object): @@ -111,8 +111,15 @@ class EnvironGuard(object): def setUp(self): super(EnvironGuard, self).setUp() - self.environ = EnvironmentVarGuard() + self.old_environ = deepcopy(os.environ) def tearDown(self): - self.environ.__exit__() + for key, value in self.old_environ.items(): + if os.environ.get(key) != value: + os.environ[key] = value + + for key in os.environ.keys(): + if key not in self.old_environ: + del os.environ[key] + super(EnvironGuard, self).tearDown() |
