classification
Title: unset PYTHON* environment variables when running tests
Type: behavior Stage:
Components: Tests Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, BreamoreBoy, ezio.melotti, henry.precheur, michael.foord, vstinner
Priority: normal Keywords: patch

Created on 2011-06-24 21:57 by henry.precheur, last changed 2014-06-28 00:11 by vstinner. This issue is now closed.

Files
File name Uploaded Description Edit
empty_environment.diff henry.precheur, 2011-06-27 12:43
Messages (4)
msg138993 - (view) Author: Henry Precheur (henry.precheur) Date: 2011-06-24 21:57
"make test" calls Python with the -E option which ignore the PYTHON*
environment variables, but Python sub-processes aren't necessarily called with the -E options. For example test_displayhook_unencodable in test_cmd_line. This created problems with my own PYTHONSTARTUP script.

I see 2 solutions to this problems:

1. Fix the tests that might be affected by such problems, by adding the -E option everywhere needed.
2. Fix the Makefile and unset all the PYTHON* environment variables in it.

I think that solution #2 is better. Fixing the tests can be done today, but the authors of future tests might not be aware of this issue. By fixing the Makefile we prevent this problem to occur again in the future.
msg139263 - (view) Author: Henry Precheur (henry.precheur) Date: 2011-06-27 12:43
Here's a small patch to call regression tests without any environment variable defined. It's probably a good thing to run all the tests with a clean state, this way they are less likely to fail for mysterious external reasons. For example test_displayhook_unencodable was failing because I was overriding displayhook in my PYTHONSTARTUP file.

On the other hand, some problems with environment variables might go unnoticed. But I don't think there's much risk.

Note that test_distutils will fail with this patch if #12420 is not taken care of beforehand.
msg221753 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-27 23:43
Can we have a formal patch review please as "make test" means nothing to me.
msg221757 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-06-28 00:11
> 1. Fix the tests that might be affected by such problems, by adding the -E option everywhere needed.

Yes, this is the right fix. I'm closing this issue because it didn't get any activity since 3 years.

If you are interested to add -E in tests, please open a new issue with a patch.

empty_environment.diff is wrong, we should ignore PYTHON environement variables to have reliable tests.
History
Date User Action Args
2014-06-28 00:11:25vstinnersetstatus: open -> closed
resolution: not a bug
messages: + msg221757
2014-06-27 23:43:29BreamoreBoysetnosy: + BreamoreBoy

messages: + msg221753
versions: + Python 3.4, Python 3.5, - Python 3.2, Python 3.3
2011-07-21 05:47:15ezio.melottisetnosy: + vstinner
2011-07-02 07:45:07terry.reedysetnosy: + ezio.melotti, michael.foord
2011-06-27 12:43:58henry.precheursetfiles: + empty_environment.diff
keywords: + patch
messages: + msg139263
2011-06-24 23:00:28Arfreversetnosy: + Arfrever
2011-06-24 21:57:56henry.precheurcreate