Issue #19360: fix test_site when Python is installed into $HOME/.local

This commit is contained in:
Antoine Pitrou 2013-10-23 22:03:22 +02:00
parent 09fcb72048
commit a1782e1be8
1 changed files with 8 additions and 2 deletions

View File

@ -179,14 +179,20 @@ class HelperFunctionsTests(unittest.TestCase):
rc = subprocess.call([sys.executable, '-s', '-c',
'import sys; sys.exit(%r in sys.path)' % usersite],
env=env)
self.assertEqual(rc, 0)
if usersite == site.getsitepackages()[0]:
self.assertEqual(rc, 1)
else:
self.assertEqual(rc, 0)
env = os.environ.copy()
env["PYTHONNOUSERSITE"] = "1"
rc = subprocess.call([sys.executable, '-c',
'import sys; sys.exit(%r in sys.path)' % usersite],
env=env)
self.assertEqual(rc, 0)
if usersite == site.getsitepackages()[0]:
self.assertEqual(rc, 1)
else:
self.assertEqual(rc, 0)
env = os.environ.copy()
env["PYTHONUSERBASE"] = "/tmp"