summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-05-09 10:06:00 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2009-05-09 10:06:00 (GMT)
commit812d77152e489cf2436691fb6ce28b6fce8f2fec (patch)
treefa8c3b5d6ffdb400e2ab04873e142f61e4a27a7d /Lib/distutils/tests
parente2be83def891db39fd4b7b707247740bd28cd811 (diff)
downloadcpython-812d77152e489cf2436691fb6ce28b6fce8f2fec.zip
cpython-812d77152e489cf2436691fb6ce28b6fce8f2fec.tar.gz
cpython-812d77152e489cf2436691fb6ce28b6fce8f2fec.tar.bz2
#5976: fixed distutils test_check_environ
Diffstat (limited to 'Lib/distutils/tests')
-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()