pytest vs. python -m pytest #9753
Unanswered
RolfBippus
asked this question in
Q&A
Replies: 2 comments 3 replies
-
that the bin folder ends in sys.path looks like a bug in conda |
Beta Was this translation helpful? Give feedback.
0 replies
-
the pytest script in conda calls pytest.console_main.
prepends the empty string to sys.path. So the problem seems to be calling |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The documentation states
This does not seem to be the whole story.
Unfortunately, calling plain
pytest
seems to prepend the path where pytest is located to sys.path.Printing sys.path in pytest_configure(), I get in a conda environment:
The latter is to be expected, the first not?!
The unfortunate thing is, I now want to test a script in my development code and import it (e.g. to call a main() method) instead of running it via subprocess. The script however is also installed in my conda environment, under bin.
Calling
python -m pytest
thus imports the development codeWhereas calling plain
pytest
imports the code from the environment.Beta Was this translation helpful? Give feedback.
All reactions