[Python-checkins] r86378 - python/branches/py3k/Lib/test/script_helper.py

antoine.pitrou python-checkins at python.org
Tue Nov 9 23:04:44 CET 2010


Author: antoine.pitrou
Date: Tue Nov  9 23:04:44 2010
New Revision: 86378

Log:
Preserve the original environment (e.g. LD_LIBRARY_PATH)



Modified:
   python/branches/py3k/Lib/test/script_helper.py

Modified: python/branches/py3k/Lib/test/script_helper.py
==============================================================================
--- python/branches/py3k/Lib/test/script_helper.py	(original)
+++ python/branches/py3k/Lib/test/script_helper.py	Tue Nov  9 23:04:44 2010
@@ -17,12 +17,13 @@
 # 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)


More information about the Python-checkins mailing list