Merged revisions 75485 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75485 | tarek.ziade | 2009-10-18 11:28:26 +0200 (Sun, 18 Oct 2009) | 1 line

  Changed distutils tests to avoid environment alteration
........
This commit is contained in:
Tarek Ziadé 2009-10-18 11:34:51 +00:00
parent ccb3c0946c
commit 430fb63dd2
13 changed files with 66 additions and 34 deletions

View file

@ -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.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 tuple(os.environ.keys()):
if key not in self.old_environ:
del os.environ[key]
super(EnvironGuard, self).tearDown()