summaryrefslogtreecommitdiffstats
path: root/Lib/test/script_helper.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2012-02-20 23:33:36 (GMT)
committerGeorg Brandl <georg@python.org>2012-02-20 23:33:36 (GMT)
commit2fb477c0f0284439d40cb3f46eea45ef42446e53 (patch)
treec8df3747d511256d56ca4af046db7915b5c06096 /Lib/test/script_helper.py
parentb5c793a0b349cb02003433c30a410595b224079f (diff)
parent9edceb3e591063f382ae82e14313813ffc1af0bf (diff)
downloadcpython-2fb477c0f0284439d40cb3f46eea45ef42446e53.zip
cpython-2fb477c0f0284439d40cb3f46eea45ef42446e53.tar.gz
cpython-2fb477c0f0284439d40cb3f46eea45ef42446e53.tar.bz2
Merge 3.2: Issue #13703 plus some related test suite fixes.
Diffstat (limited to 'Lib/test/script_helper.py')
-rw-r--r--Lib/test/script_helper.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/script_helper.py b/Lib/test/script_helper.py
index e556eca..10ada6d 100644
--- a/Lib/test/script_helper.py
+++ b/Lib/test/script_helper.py
@@ -3,7 +3,6 @@
import sys
import os
-import re
import os.path
import tempfile
import subprocess
@@ -20,11 +19,15 @@ def _assert_python(expected_success, *args, **env_vars):
cmd_line = [sys.executable]
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()
+ # But a special flag that can be set to override -- in this case, the
+ # caller is responsible to pass the full environment.
+ if env_vars.pop('__cleanenv', None):
+ env = {}
env.update(env_vars)
+ cmd_line.extend(args)
p = subprocess.Popen(cmd_line, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=env)