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

using pytest.mark.skipIf doesn't skip anything, but calling pytest.mark.skipif (all lower case) works #2355

Closed
knifewine opened this issue Apr 7, 2017 · 5 comments
Labels
status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity type: enhancement new feature or API change, should be merged into features branch

Comments

@knifewine
Copy link

I can provide more details if needed, just ask.

pytest.mark.skipIf(True) does not skip anything

pytest.mark.skipif(True) works though.

This is pretty confusing.

Python 2.7, pytest 3.0.7.

@RonnyPfannschmidt
Copy link
Member

py.test --strict would complain,

@hpk42 @nicoddemus should we do something like we do for parameterize wrt the possible spelling mistakes ?

@RonnyPfannschmidt RonnyPfannschmidt added type: enhancement new feature or API change, should be merged into features branch status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity labels Apr 7, 2017
@nicoddemus
Copy link
Member

Is this a common mistake? After all, Python is case-sensitive...

If we decide to do something about it, we can easily do a check like we do we parametrize like @RonnyPfannschmidt suggests.

@robert-cody
Copy link

isInstance() also doesn't work, but isinstance() works fine, same for skipIf() and skip_if(), etc. There is no reason to complain that nonexistent function doesn't work, it's pretty expected behavior.

@knifewine
Copy link
Author

I wasn't aware it's a non-existent function, but point taken. It's a surprising usability issue imo, but was just trying to be helpful by reporting what I ran into. Cheers.

@nicoddemus
Copy link
Member

It is not the same as isInstance because isInstance will blow up immediately while pytest.mark.skipIf will silently create a new marker named skipIf that does nothing, which I believe was the point @knifewine was making.

It might be worth doing a similar check for all builtin markers, I was just wondering if that was a common mistake or not (parametrize being misspelled as parameterize was, so much we decided to warn against it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

4 participants