-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Calling pytest.skip no longer works at module level in pytest 3 #1959
Comments
The Main Problem is decorator usage is a huge part oft misstakes that people do very regular At module level you can always use a marker just as well |
Hi @Nikratio, Just to add what @RonnyPfannschmidt said, you can use a marker instead: if SOME_CONDITION:
pytestmark = pytest.mark.skip('skipping entire module') This will apply the
I disagree that the documentation is misleading: Using @pytest.skip outside of a test implies that using it inside a test is OK, and e.g. as a test function decorator is just an example. That's not to say that it can be improved. A PR improving the wording would be welcome! I think we can close this for now, feel free to re-open it if you still have questions or comments. |
I'm mostly objecting to including the decorator-
(note the use of |
Oh I agree that's a nicer message. Would you mind submitting a PR? 😁 |
As discussed in issue pytest-dev#1959.
Consider the following test:
In pytest 2.9.1 it works just fine:
but in pytest 3 it fails:
Note, however, that calling
pytest.skip
inside a test continues to work with both pytest 2 and pytest 3:So I think even if calling
pytest.skip
at module level is deliberately no longer allowed, the error message is misleading. I'm not using it as a decorator, and using it imperatively inside a test function is apparently allowed too.The text was updated successfully, but these errors were encountered: