summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests/test_util.py
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-05-09 10:09:11 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2009-05-09 10:09:11 (GMT)
commitbe5b1b99737271a1f7d9748203b7ee116dd0ce61 (patch)
treedcc11ea6e742e14ebd3a9cef18d265d906e4c4f0 /Lib/distutils/tests/test_util.py
parent44b345460a9c6e38154df8bfc2afe1d26a35849b (diff)
downloadcpython-be5b1b99737271a1f7d9748203b7ee116dd0ce61.zip
cpython-be5b1b99737271a1f7d9748203b7ee116dd0ce61.tar.gz
cpython-be5b1b99737271a1f7d9748203b7ee116dd0ce61.tar.bz2
Merged revisions 72500 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72500 | tarek.ziade | 2009-05-09 12:06:00 +0200 (Sat, 09 May 2009) | 1 line #5976: fixed distutils test_check_environ ........
Diffstat (limited to 'Lib/distutils/tests/test_util.py')
-rw-r--r--Lib/distutils/tests/test_util.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/Lib/distutils/tests/test_util.py b/Lib/distutils/tests/test_util.py
index 348933e..ea7c592 100644
--- a/Lib/distutils/tests/test_util.py
+++ b/Lib/distutils/tests/test_util.py
@@ -214,12 +214,17 @@ class utilTestCase(unittest.TestCase):
# posix without HOME
if os.name == 'posix': # this test won't run on windows
- os.environ = {}
- check_environ()
-
- import pwd
- self.assertEquals(os.environ['HOME'],
- pwd.getpwuid(os.getuid())[5])
+ old_home = os.environ.get('HOME')
+ try:
+ check_environ()
+ import pwd
+ self.assertEquals(os.environ['HOME'],
+ pwd.getpwuid(os.getuid())[5])
+ finally:
+ if old_home is not None:
+ os.environ['HOME'] = old_home
+ else:
+ del os.environ['HOME']
else:
check_environ()