]> granicus.if.org Git - python/commitdiff
Preserve the original environment (e.g. LD_LIBRARY_PATH)
authorAntoine Pitrou <solipsis@pitrou.net>
Tue, 9 Nov 2010 22:04:44 +0000 (22:04 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Tue, 9 Nov 2010 22:04:44 +0000 (22:04 +0000)
Lib/test/script_helper.py

index 095895ee50d5b38f43aeac84f7eca06ce2cde6c6..14e113bd397f6d3136d092454e5066c83515646f 100644 (file)
@@ -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)