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
pytest -k
should ignore private attributes (starting with _
)
#7539
Comments
hypothesis is attaching additional attributes to the test function which is triggering this:
|
Is there a way to make -k only match function names? I don't care about that other stuff. |
Hi @asmeurer, I'm afraid not at the moment with the |
this behaviour has existed since pytest 2.4.0 but as far as I can tell is undocumented (and wasn't called out in the changelog) I think at least this should be documented and improved to avoid underscored names (this would solve this particular issue, but I think would be a reasonable baseline expectation) |
Created #7546 to track this. |
pytest -k
should ignore private attributes (starting with _
)
I originally opened this issue in hypothesis, but they told me to open it here HypothesisWorks/hypothesis#2508.
When I run
pytest -k name
, andname
only matches hypothesis tests, pytest runs all hypothesis tests, not just the ones that match. When name matches a non-hypothesis test, it only picks the tests that contain name as expected.I am using pytest 5.4.3 and hypothesis 5.21.0. It happens even when I set aside my pytest.ini and conftest.py.
You can reproduce this at the repo https://github.com/Quansight/ndindex/ by running
pytest -v -k repr
.The text was updated successfully, but these errors were encountered: