This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_cmd_line failing on PYTHONSTARTUP
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: python-dev, r.david.murray, slashfoo
Priority: normal Keywords: patch

Created on 2015-04-13 01:18 by slashfoo, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pythonrc slashfoo, 2015-04-13 01:18 PYTHONSTARTUP file
fix-issue23925.patch slashfoo, 2015-04-14 02:59 patch to fix the issue review
Messages (4)
msg240581 - (view) Author: Jamiel Almeida (slashfoo) * Date: 2015-04-13 01:18
Running the test test_cmd_line with my current PYTHONSTARTUP set to the attached file breaks the test.

$ ./python.exe -m test test_cmd_line

Changing line 280 on Lib/test/test_cmd_line.py to include either -I or -E makes the error be different but still breaks the test.

adding a line with `del env['PYTHONSTARTUP']` before the subprocess works around the issue.

This leads me to believe that -E and -I aren't fully ignoring the environment variable.

Running with:
$ PYTHONSTARTUP= ./python.exe -m test test_cmd_line

Also works around the issue.

Ran the following to build python and run tests

$ hg clone https://hg.python.org/cpython
$ cd cpython
$ ./configure --with-pydebug && make -j4
$ ./python -m test -j4

Currently on revision: 2a18f6b85da2 2015-04-12 | [rdmurray] #23464: remove JoinableQueue that was deprecated in 3.4.4.
msg240833 - (view) Author: Jamiel Almeida (slashfoo) * Date: 2015-04-14 02:59
As pointed by ncoghlan, the test needs to (by definition) not use -E or -I, but PYTHONSTARTUP env var breaks the test, so the patch makes the env not have any pre-existing PYTHON* env vars.

Ideally this should be another type of helper in script_helper, no?
msg241038 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-04-14 21:59
New changeset d0819a8fda1b by R David Murray in branch '3.4':
#23925: stop (eg) PYTHONSTARTUP from causing test_cmd_line failure.
https://hg.python.org/cpython/rev/d0819a8fda1b

New changeset 3a3dc86a5b6e by R David Murray in branch 'default':
Merge: #23925: stop (eg) PYTHONSTARTUP from causing test_cmd_line failure.
https://hg.python.org/cpython/rev/3a3dc86a5b6e
msg241039 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-04-14 22:03
Thanks, Jamiel.  I tweaked the comment.  I don't think it is worth making this a helper, since the only time it is likely to be needed is in test_cmd_line.  If there are other tests in test_cmd_line that test PYTHON environment variables then it might be worth adding it as a helper in test_cmd_line.
History
Date User Action Args
2022-04-11 14:58:15adminsetgithub: 68113
2015-04-14 22:03:47r.david.murraysetstatus: open -> closed

versions: + Python 3.4
nosy: + r.david.murray

messages: + msg241039
resolution: fixed
stage: resolved
2015-04-14 21:59:00python-devsetnosy: + python-dev
messages: + msg241038
2015-04-14 02:59:07slashfoosetfiles: + fix-issue23925.patch
keywords: + patch
messages: + msg240833
2015-04-13 01:18:13slashfoocreate