Skip to content

Conversation

@The-Compiler
Copy link
Member

Not sure if this should qualify as a bugfix, or if it should rather be a breaking change? Though affected tests were silently skipped before, which seems quite bad.

The `--strict` argument was removed in pytest-dev#2552, but the removal wasn't
actually correct - see pytest-dev#1472.
reason = "unconditional skip"
return Skip(reason)
try:
return Skip(*mark.args, **mark.kwargs)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the existing __init__ rather than hand-rolling argument parsing will also catch other issues, like giving too many arguments to the mark. All those were silently ignored before.

"""
)
result = pytester.runpytest("-rs")
result = pytester.runpytest("-rs", "--strict-markers")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related, see #2552 (comment)

try:
return Skip(*mark.args, **mark.kwargs)
except TypeError as e:
raise TypeError(str(e) + " - maybe you meant pytest.mark.skipif?")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not doing "from e" here because it's not really relevant to the user where the exception comes from.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would from None Make sense to completely suppress it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable - added!

@nicoddemus
Copy link
Member

nicoddemus commented Mar 3, 2021

Not sure if this should qualify as a bugfix, or if it should rather be a breaking change?

Yeah it is a bit ambiguous, but IMHO the breaking change only happens because of misuse (according to the documentation), plus the misuse is hiding a problem, so I consider it a bugfix. 👍

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely

Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me - and I'd be happy to close #8384 on the basis that skip and skipif are now clearly distinct.

Copy link
Member Author

@The-Compiler The-Compiler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks everyone for the quick reviews!

@The-Compiler The-Compiler merged commit c14a9ad into pytest-dev:master Mar 4, 2021
@The-Compiler The-Compiler deleted the fix-skip-signature branch March 4, 2021 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants