New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_site modifies sys.path #74294
Comments
See on Travis CI: https://travis-ci.org/python/cpython/jobs/223771666 Warning -- sys.path was modified by test_site Before: (47345855849656, ['', '/usr/local/lib/python37.zip', '/home/travis/build/python/cpython/Lib', '/home/travis/build/python/cpython/build/lib.linux-x86_64-3.7-pydebug'], ['', '/usr/local/lib/python37.zip', '/home/travis/build/python/cpython/Lib', '/home/travis/build/python/cpython/build/lib.linux-x86_64-3.7-pydebug']) After: (47345855849656, ['', '/usr/local/lib/python37.zip', '/home/travis/build/python/cpython/Lib', '/home/travis/build/python/cpython/build/lib.linux-x86_64-3.7-pydebug'], ['', '/usr/local/lib/python37.zip', '/home/travis/build/python/cpython/Lib', '/home/travis/build/python/cpython/build/lib.linux-x86_64-3.7-pydebug', '/home/travis/.local/lib/python3.7/site-packages']) |
Ah, I reproduced the bug: $ rmdir ~/.local/lib/python3.7/site-packages; ./python -m test test_site
Run tests sequentially
0:00:00 [1/1] test_site
Warning -- sys.path was modified by test_site
Before: (140302199734024, ['', '/home/haypo/prog/GIT/perf', '/usr/local/lib/python37.zip', '/home/haypo/prog/python/master/Lib', '/home/haypo/prog/python/master/build/lib.linux-x86_64-3.7'], ['', '/home/haypo/prog/GIT/perf', '/usr/local/lib/python37.zip', '/home/haypo/prog/python/master/Lib', '/home/haypo/prog/python/master/build/lib.linux-x86_64-3.7'])
After: (140302199734024, ['', '/home/haypo/prog/GIT/perf', '/usr/local/lib/python37.zip', '/home/haypo/prog/python/master/Lib', '/home/haypo/prog/python/master/build/lib.linux-x86_64-3.7'], ['', '/home/haypo/prog/GIT/perf', '/usr/local/lib/python37.zip', '/home/haypo/prog/python/master/Lib', '/home/haypo/prog/python/master/build/lib.linux-x86_64-3.7', '/home/haypo/.local/lib/python3.7/site-packages'])
test_site failed (env changed) 1 test altered the execution environment: Total duration: 229 ms |
I'm wondering if the user site directory should be removed in tearDownModule(). |
Serhiy Storchaka added the comment:
Writing into $HOME/.local is just completely wrong :-) The test suite On a buildbot, $HOME is the root directory / and so the test is If you want to enhance the code: setUpModule() should mock $HOME to |
The initial issue (test_site modifies sys.path) has been fixed. I don't think that it's worth it to backport the change, it's just a warning in tests. @serhiy: Feel free to open a new issue if you want to enhance test_site ;-) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: