Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit adffced

Browse files
committed
Preserve the original environment (e.g. LD_LIBRARY_PATH)
1 parent 84c29a2 commit adffced

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Lib/test/script_helper.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
# Executing the interpreter in a subprocess
1818
def _assert_python(expected_success, *args, **env_vars):
1919
cmd_line = [sys.executable]
20-
if env_vars:
21-
env = env_vars
22-
else:
23-
env = os.environ
20+
if not env_vars:
2421
cmd_line.append('-E')
2522
cmd_line.extend(args)
23+
# Need to preserve the original environment, for in-place testing of
24+
# shared library builds.
25+
env = os.environ.copy()
26+
env.update(env_vars)
2627
p = subprocess.Popen(cmd_line, stdin=subprocess.PIPE,
2728
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
2829
env=env)

0 commit comments

Comments
 (0)