import from test
broken by pip install
#8270
-
I'm working in a repo that has tests and some test helper libraries in a directory named Activate a fresh pyenv virtualenv and install the latest pytest with
Running test/real_test.py does the expected, failing a test. Now
Running
Mysteriously to me after running I suspect moving our tests from |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@hoefling provided a rather complete explanation in comments to this question at https://stackoverflow.com/questions/65910240/pytest-breaks-with-pip-install "Short answer - don't create packages or modules that are name-shadowing the standard library, this will always break something sooner or later" "As a workaround, I can suggest creating a Thank you Oleg! |
Beta Was this translation helpful? Give feedback.
@hoefling provided a rather complete explanation in comments to this question at https://stackoverflow.com/questions/65910240/pytest-breaks-with-pip-install
"Short answer - don't create packages or modules that are name-shadowing the standard library, this will always break something sooner or later"
"As a workaround, I can suggest creating a
conftest.py
in the project root dir with the contentsimport sys; sys.modules.pop("test", None)
- this should resolve the import issue."Thank you Oleg!