-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
pytest collects files when told not to #11006
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
Comments
Hi @CobaltCause, This is not really a bug, but an intended (albeit questionable) behavior: The values of pytest/src/_pytest/config/__init__.py Lines 1382 to 1384 in 739408b
If you create the I agree those 2 facts are surprising:
I don't think we can do anything more for 1, but for 2 seems like we should at least emit a warning if |
Oh, interesting. Yeah, this is quite surprising behavior. Making a |
Created #11013 to issue the warning/error, closing this one then. Thanks @CobaltCause for the report! |
I can reproduce this with a project set up as follows:
pyproject.toml
:src/playground/__init__.py
exists and is emptysrc/playground/__main__.py
:tests
does not existWhen I run
pytest
, I get this output:I would expect this to succesfully collect nothing and run no tests, but instead it fails because it runs
__main__.py
. Notably, if I removepython_files = "*.py"
frompyproject.toml
, it works. It seems like this shouldn't matter, though, because I'm already narrowingtestpaths
totests
.The text was updated successfully, but these errors were encountered: