@@ -26,14 +26,15 @@ which also serve as documentation.
26
26
:ref: `fixtures <fixtures >`.
27
27
28
28
29
- Raising errors on unknown marks: --strict
30
- -----------------------------------------
29
+ .. _unknown-marks :
31
30
32
- When the ``--strict `` command-line flag is passed, any unknown marks applied
33
- with the ``@pytest.mark.name_of_the_mark `` decorator will trigger an error.
34
- Marks defined or added by pytest or by a plugin will not trigger an error.
31
+ Raising errors on unknown marks
32
+ -------------------------------
35
33
36
- Marks can be registered in ``pytest.ini `` like this:
34
+ Unknown marks applied with the ``@pytest.mark.name_of_the_mark `` decorator
35
+ will always emit a warning, in order to avoid silently doing something
36
+ surprising due to mis-typed names. You can disable the warning for custom
37
+ marks by registering them in ``pytest.ini `` like this:
37
38
38
39
.. code-block :: ini
39
40
@@ -42,8 +43,11 @@ Marks can be registered in ``pytest.ini`` like this:
42
43
slow
43
44
serial
44
45
45
- This can be used to prevent users mistyping mark names by accident. Test suites that want to enforce this
46
- should add ``--strict `` to ``addopts ``:
46
+ When the ``--strict `` command-line flag is passed, any unknown marks applied
47
+ with the ``@pytest.mark.name_of_the_mark `` decorator will trigger an error.
48
+ Marks added by pytest or by a plugin instead of the decorator will not trigger
49
+ the warning or this error. Test suites that want to enforce a limited set of
50
+ markers can add ``--strict `` to ``addopts ``:
47
51
48
52
.. code-block :: ini
49
53
@@ -53,6 +57,9 @@ should add ``--strict`` to ``addopts``:
53
57
slow
54
58
serial
55
59
60
+ Third-party plugins should always :ref: `register their markers <registering-markers >`
61
+ so that they appear in pytest's help text and do not emit warnings.
62
+
56
63
57
64
.. _marker-revamp :
58
65
0 commit comments