Merge pull request #4208 from nicoddemus/pytestskip-docs-4206

Remove pytest.config example from skipping at module level docs
This commit is contained in:
Anthony Sottile 2018-10-21 10:28:53 -07:00 committed by GitHub
commit c94b2b227e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -58,18 +58,20 @@ by calling the ``pytest.skip(reason)`` function:
if not valid_config(): if not valid_config():
pytest.skip("unsupported configuration") pytest.skip("unsupported configuration")
The imperative method is useful when it is not possible to evaluate the skip condition
during import time.
It is also possible to skip the whole module using It is also possible to skip the whole module using
``pytest.skip(reason, allow_module_level=True)`` at the module level: ``pytest.skip(reason, allow_module_level=True)`` at the module level:
.. code-block:: python .. code-block:: python
import sys
import pytest import pytest
if not pytest.config.getoption("--custom-flag"): if not sys.platform.startswith("win"):
pytest.skip("--custom-flag is missing, skipping tests", allow_module_level=True) pytest.skip("skipping windows-only tests", allow_module_level=True)
The imperative method is useful when it is not possible to evaluate the skip condition
during import time.
**Reference**: :ref:`pytest.mark.skip ref` **Reference**: :ref:`pytest.mark.skip ref`