summaryrefslogtreecommitdiffstats
path: root/Lib/test/script_helper.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-11-09 22:04:44 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-11-09 22:04:44 (GMT)
commitadffced3df2368a20a6f122f301886be4430a538 (patch)
tree015532031bcfa887bc83e4710a6a251cf10bc78f /Lib/test/script_helper.py
parent84c29a2e16257a11b9070453ae0ed3df6d60aa8e (diff)
downloadcpython-adffced3df2368a20a6f122f301886be4430a538.zip
cpython-adffced3df2368a20a6f122f301886be4430a538.tar.gz
cpython-adffced3df2368a20a6f122f301886be4430a538.tar.bz2
Preserve the original environment (e.g. LD_LIBRARY_PATH)
Diffstat (limited to 'Lib/test/script_helper.py')
-rw-r--r--Lib/test/script_helper.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/script_helper.py b/Lib/test/script_helper.py
index 095895e..14e113b 100644
--- a/Lib/test/script_helper.py
+++ b/Lib/test/script_helper.py
@@ -17,12 +17,13 @@ from test.support import make_legacy_pyc
# Executing the interpreter in a subprocess
def _assert_python(expected_success, *args, **env_vars):
cmd_line = [sys.executable]
- if env_vars:
- env = env_vars
- else:
- env = os.environ
+ if not env_vars:
cmd_line.append('-E')
cmd_line.extend(args)
+ # Need to preserve the original environment, for in-place testing of
+ # shared library builds.
+ env = os.environ.copy()
+ env.update(env_vars)
p = subprocess.Popen(cmd_line, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=env)