Commit 92dcb8df authored by Robert Bradshaw's avatar Robert Bradshaw

Simplify environment handling in srctree tests.

parent eb0e4666
...@@ -1525,13 +1525,14 @@ class EndToEndTest(unittest.TestCase): ...@@ -1525,13 +1525,14 @@ class EndToEndTest(unittest.TestCase):
.replace("CYTHON", "PYTHON %s" % os.path.join(self.cython_root, 'cython.py')) .replace("CYTHON", "PYTHON %s" % os.path.join(self.cython_root, 'cython.py'))
.replace("PYTHON", sys.executable)) .replace("PYTHON", sys.executable))
old_path = os.environ.get('PYTHONPATH') old_path = os.environ.get('PYTHONPATH')
os.environ['PYTHONPATH'] = self.cython_syspath + os.pathsep + (old_path or '') env = dict(os.environ)
try: env['PYTHONPATH'] = self.cython_syspath + os.pathsep + (old_path or '')
for command in filter(None, commands.splitlines()): for command in filter(None, commands.splitlines()):
p = subprocess.Popen(command, p = subprocess.Popen(command,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
shell=True) shell=True,
env=env)
out, err = p.communicate() out, err = p.communicate()
res = p.returncode res = p.returncode
if res != 0: if res != 0:
...@@ -1539,11 +1540,6 @@ class EndToEndTest(unittest.TestCase): ...@@ -1539,11 +1540,6 @@ class EndToEndTest(unittest.TestCase):
print(self._try_decode(out)) print(self._try_decode(out))
print(self._try_decode(err)) print(self._try_decode(err))
self.assertEqual(0, res, "non-zero exit status") self.assertEqual(0, res, "non-zero exit status")
finally:
if old_path:
os.environ['PYTHONPATH'] = old_path
else:
del os.environ['PYTHONPATH']
self.success = True self.success = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment