mirror of https://github.com/python/cpython
#5976: fixed distutils test_check_environ
This commit is contained in:
parent
e2be83def8
commit
812d77152e
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue