pytest: Emit warnings on use of unknown marks
One of the most common problems I see, and help debug, is typos in @pytest.mark.whatever
decorators. Just recently we’ve had #4639 and #4814, and I’ve read three sets of unrelated docs in the last week that explicitly point out the spelling of mark.parametrize
(not parameterize
!).
The --strict
argument helps, but is clearly insufficient by default. On the other hand, it can’t be an error until a major version bump.
Happily, there is a standard middle ground: warnings! I therefore propose to emit a warning every time an unknown name is used as an attribute of pytest.mark
. The message should include how to register the mark, why unregistered marks are problematic, and note that this warning may become an error in a future version of pytest.
Unless there are major objections to this plan, I’ll try for an implementation over the weekend.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 21 (15 by maintainers)
Commits related to this issue
- Merge #32 32: Pin pytest to latest version 5.1.3 r=duckinator a=pyup-bot This PR pins [pytest](https://pypi.org/project/pytest) to the latest release **5.1.3**. <details> <summary>Changelog</s... — committed to duckinator/bork by bors[bot] 5 years ago
- Merge #1 1: Initial Update r=aragilar a=pyup-bot This PR sets up pyup.io on this repo and updates all dependencies at once, in a single branch. Subsequent pull requests will update one dependency... — committed to aragilar/pytest-info-collector by bors[bot] 4 years ago
- Merge #1 1: Initial Update r=aragilar a=pyup-bot This PR sets up pyup.io on this repo and updates all dependencies at once, in a single branch. Subsequent pull requests will update one dependency... — committed to aragilar/spaceplot by bors[bot] 4 years ago
- Merge #1 1: Initial Update r=aragilar a=pyup-bot This PR sets up pyup.io on this repo and updates all dependencies at once, in a single branch. Subsequent pull requests will update one dependency... — committed to aragilar/venv_tools by bors[bot] 4 years ago
- Merge #5 5: Initial Update r=aragilar a=pyup-bot This PR sets up pyup.io on this repo and updates all dependencies at once, in a single branch. Subsequent pull requests will update one dependency... — committed to aragilar/root-solver by bors[bot] 4 years ago
@1313e
Took a quick look and that does not seem to be the case:
https://bitbucket.org/pytest-dev/pytest-pep8/src/44ddb3739f0f892fc0029d5d809496ec5ef24f28/pytest_pep8.py#lines-12:21
The
pep8
mark should be registered like shown here.