Skip to content

Commit 687592d

Browse files
committed
Merge: #23925: stop (eg) PYTHONSTARTUP from causing test_cmd_line failure.
2 parents 14a88ab + f4bbc53 commit 687592d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/test/test_cmd_line.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@ def test_empty_PYTHONPATH_issue16309(self):
271271

272272
def test_displayhook_unencodable(self):
273273
for encoding in ('ascii', 'latin-1', 'utf-8'):
274-
env = os.environ.copy()
274+
# We are testing a PYTHON environment variable here, so we can't
275+
# use -E, -I, or script_helper (which uses them). So instead we do
276+
# poor-man's isolation by deleting the PYTHON vars from env.
277+
env = {key:value for (key,value) in os.environ.copy().items()
278+
if not key.startswith('PYTHON')}
275279
env['PYTHONIOENCODING'] = encoding
276280
p = subprocess.Popen(
277281
[sys.executable, '-i'],

0 commit comments

Comments
 (0)