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 · 2 comments

Comments

Projects
None yet
2 participants
@uSpike
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

This comment has been minimized.

Member

nicoddemus commented Feb 9, 2018

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 uSpike referenced this issue Feb 9, 2018

Merged

Add "--deselect" command line option #3201

5 of 5 tasks complete

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

This comment has been minimized.

Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment