Skip to content
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

Ignore individual tests #3198

Closed
uSpike opened this issue Feb 9, 2018 · 3 comments
Closed

Ignore individual tests #3198

uSpike opened this issue Feb 9, 2018 · 3 comments
Labels
type: enhancement new feature or API change, should be merged into features branch type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature

Comments

@uSpike
Copy link
Member

uSpike commented Feb 9, 2018

It would be useful for my workflow to be able to ignore specific tests while still collecting an entire directory.

For example, I have:

tests/
    test_a.py # contains test_foo(), test_bar()
    test_b.py # contains test_baz(), test_buz()

I can currently use --ignore to ignore an entire file, but not a specific test. If I want to run every test except for test_a.py::test_foo I will have a very long command line.

I propose to accept test ids with --ignore:

$ pytest tests --ignore tests/test_a.py::test_foo
$ pytest tests --ignore tests/test_a.py::test_foo[param]

Thoughts? I'd be glad to submit a PR.

@nicoddemus nicoddemus added type: enhancement new feature or API change, should be merged into features branch type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature labels Feb 9, 2018
@nicoddemus
Copy link
Member

Seems useful at first sight. Feel free to submit a PR. 👍

uSpike pushed a commit to uSpike/pytest that referenced this issue Feb 9, 2018
uSpike added a commit to uSpike/pytest that referenced this issue Feb 9, 2018
uSpike added a commit to uSpike/pytest that referenced this issue Feb 9, 2018
uSpike added a commit to uSpike/pytest that referenced this issue Feb 9, 2018
uSpike added a commit to uSpike/pytest that referenced this issue Feb 12, 2018
uSpike added a commit to uSpike/pytest that referenced this issue Feb 15, 2018
uSpike added a commit to uSpike/pytest that referenced this issue Feb 15, 2018
uSpike added a commit to uSpike/pytest that referenced this issue Feb 15, 2018
uSpike added a commit to uSpike/pytest that referenced this issue Feb 16, 2018
uSpike added a commit to uSpike/pytest that referenced this issue Feb 16, 2018
uSpike added a commit to uSpike/pytest that referenced this issue Feb 16, 2018
@uSpike
Copy link
Member Author

uSpike commented Feb 16, 2018

I submitted #3201 with a different implementation than I proposed. I opted to add --deselect [node_prefix] which would deselect tests during collection. I came to the conclusion that --ignore is too tied to paths to be extended for individual tests. What I wanted to implement was a way to ignore individual nodeids, and other options like -k didn't quite fit the bill.

@Hi-Angel
Copy link

FTR, I figured there's a more convenient way to ignore tests, which supports a pattern match, that is -k "not test_foo"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement new feature or API change, should be merged into features branch type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature
Projects
None yet
Development

No branches or pull requests

3 participants