Skip to content

fix(skipping): raise TypeError on unexpected keyword args in pytest.mark.skipif (#14839) - #14873

Closed
harmehak0173 wants to merge 2 commits into
pytest-dev:mainfrom
harmehak0173:fix/issue-14839-skipif-kwargs
Closed

fix(skipping): raise TypeError on unexpected keyword args in pytest.mark.skipif (#14839)#14873
harmehak0173 wants to merge 2 commits into
pytest-dev:mainfrom
harmehak0173:fix/issue-14839-skipif-kwargs

Conversation

@harmehak0173

Copy link
Copy Markdown

Summary of Changes

Fixes #14839 where pytest.mark.skipif silently ignores extra/unexpected keyword arguments passed to the mark constructor (such as @pytest.mark.skipif(True, unexpected_arg=123)).

  • Updated evaluate_skip_marks in src/_pytest/skipping.py to validate mark.kwargs against allowed keys (condition, reason), raising a clear TypeError if unexpected keyword arguments are supplied.
  • Added unit test test_skipif_unexpected_keyword_args in testing/test_skipping.py.

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

dupe ...

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.

pytest.mark.skipif silently ignores extra keyword args

2 participants