pytest-dev / pytest-dev/pytest
--strict-markers could enable the warning to cause an error
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
The --strict-markers option is not really necessary given that there is a warning already always, which could be turned into an error:
So --strict-markers could be kept, but configure the warning accordingly.
This would make it more flexible in general, e.g. when you want to disable the option in a test.
(my current workaround was to monkeypatch pytestconfig - I'd rather would have liked to use filterwarnings):
# Register markers for `--strict-markers`.
added_markers = pytestconfig._inicache["markers"] + [
"funcmark",
"prepended",
"funcmark2",
]
monkeypatch.setitem(pytestconfig._inicache, "markers", added_markers)
)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/_pytest/mark/structures.py at the linked lines and inspect how the unknown-marker warning relates to --strict-markers. Trace the warning configuration and filterwarnings behavior, then verify that the warning can be promoted to or suppressed as an error while --strict-markers remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100