Add example for registering multiple custom mark (#7886)
This commit is contained in:
parent
69419cb700
commit
5182c73fea
1
AUTHORS
1
AUTHORS
|
@ -233,6 +233,7 @@ Pieter Mulder
|
||||||
Piotr Banaszkiewicz
|
Piotr Banaszkiewicz
|
||||||
Piotr Helm
|
Piotr Helm
|
||||||
Prashant Anand
|
Prashant Anand
|
||||||
|
Prashant Sharma
|
||||||
Pulkit Goyal
|
Pulkit Goyal
|
||||||
Punyashloka Biswal
|
Punyashloka Biswal
|
||||||
Quentin Pradet
|
Quentin Pradet
|
||||||
|
|
|
@ -221,14 +221,19 @@ Registering markers for your test suite is simple:
|
||||||
[pytest]
|
[pytest]
|
||||||
markers =
|
markers =
|
||||||
webtest: mark a test as a webtest.
|
webtest: mark a test as a webtest.
|
||||||
|
slow: mark test as slow.
|
||||||
|
|
||||||
You can ask which markers exist for your test suite - the list includes our just defined ``webtest`` markers:
|
Multiple custom markers can be registered, by defining each one in its own line, as shown in above example.
|
||||||
|
|
||||||
|
You can ask which markers exist for your test suite - the list includes our just defined ``webtest`` and ``slow`` markers:
|
||||||
|
|
||||||
.. code-block:: pytest
|
.. code-block:: pytest
|
||||||
|
|
||||||
$ pytest --markers
|
$ pytest --markers
|
||||||
@pytest.mark.webtest: mark a test as a webtest.
|
@pytest.mark.webtest: mark a test as a webtest.
|
||||||
|
|
||||||
|
@pytest.mark.slow: mark test as slow.
|
||||||
|
|
||||||
@pytest.mark.filterwarnings(warning): add a warning filter to the given test. see https://docs.pytest.org/en/stable/warnings.html#pytest-mark-filterwarnings
|
@pytest.mark.filterwarnings(warning): add a warning filter to the given test. see https://docs.pytest.org/en/stable/warnings.html#pytest-mark-filterwarnings
|
||||||
|
|
||||||
@pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.
|
@pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.
|
||||||
|
|
Loading…
Reference in New Issue