Add example for registering multiple custom mark (#7886)

This commit is contained in:
Prashant Sharma 2020-10-14 17:47:50 +05:30 committed by GitHub
parent 69419cb700
commit 5182c73fea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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.