Skip to content

Commit 95204ed

Browse files
committed
mark: enable "parametrize" misspelling error even in strict_markers mode
I figure the misspelling error is better than the "not found in `markers`" error.
1 parent efa9eff commit 95204ed

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/_pytest/mark/structures.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,11 @@ def __getattr__(self, name: str) -> MarkDecorator:
580580
# If the name is not in the set of known marks after updating,
581581
# then it really is time to issue a warning or an error.
582582
if name not in self._markers:
583+
# Raise a specific error for common misspellings of "parametrize".
584+
if name in ["parameterize", "parametrise", "parameterise"]:
585+
__tracebackhide__ = True
586+
fail(f"Unknown '{name}' mark, did you mean 'parametrize'?")
587+
583588
strict_markers = (
584589
self._config.getini("strict_markers") or self._config.option.strict
585590
)
@@ -589,11 +594,6 @@ def __getattr__(self, name: str) -> MarkDecorator:
589594
pytrace=False,
590595
)
591596

592-
# Raise a specific error for common misspellings of "parametrize".
593-
if name in ["parameterize", "parametrise", "parameterise"]:
594-
__tracebackhide__ = True
595-
fail(f"Unknown '{name}' mark, did you mean 'parametrize'?")
596-
597597
warnings.warn(
598598
f"Unknown pytest.mark.{name} - is this a typo? You can register "
599599
"custom marks to avoid this warning - for details, see "

0 commit comments

Comments
 (0)