diff --git a/changelog/3549.doc.rst b/changelog/3549.doc.rst new file mode 100644 index 000000000..62bc4f9a5 --- /dev/null +++ b/changelog/3549.doc.rst @@ -0,0 +1 @@ +Add documentation for the ``--strict`` flag. diff --git a/doc/en/mark.rst b/doc/en/mark.rst index e48135b10..e47b8c3fb 100644 --- a/doc/en/mark.rst +++ b/doc/en/mark.rst @@ -26,10 +26,30 @@ which also serve as documentation. :ref:`fixtures `. -.. currentmodule:: _pytest.mark.structures -.. autoclass:: Mark - :members: - :noindex: +Raising errors on unknown marks: --strict +----------------------------------------- + +When the ``--strict`` command-line flag is passed, any marks not registered in the ``pytest.ini`` file will trigger an error. + +Marks can be registered like this: + +.. code-block:: ini + + [pytest] + markers = + slow + serial + +This can be used to prevent users mistyping mark names by accident. Test suites that want to enforce this +should add ``--strict`` to ``addopts``: + +.. code-block:: ini + + [pytest] + addopts = --strict + markers = + slow + serial .. `marker-iteration`