Remove pytest.config example from skipping at module level docs

This commit is contained in:
Bruno Oliveira 2018-10-20 11:28:39 -03:00
parent b0eed7b56c
commit 6b126997e1
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`