Skip to content

Commit c94b2b2

Browse files
author
Anthony Sottile
authored
Merge pull request pytest-dev#4208 from nicoddemus/pytestskip-docs-4206
Remove pytest.config example from skipping at module level docs
2 parents cd72e23 + 6b12699 commit c94b2b2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

doc/en/skipping.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,20 @@ by calling the ``pytest.skip(reason)`` function:
5858
if not valid_config():
5959
pytest.skip("unsupported configuration")
6060
61+
The imperative method is useful when it is not possible to evaluate the skip condition
62+
during import time.
63+
6164
It is also possible to skip the whole module using
6265
``pytest.skip(reason, allow_module_level=True)`` at the module level:
6366

6467
.. code-block:: python
6568
69+
import sys
6670
import pytest
6771
68-
if not pytest.config.getoption("--custom-flag"):
69-
pytest.skip("--custom-flag is missing, skipping tests", allow_module_level=True)
72+
if not sys.platform.startswith("win"):
73+
pytest.skip("skipping windows-only tests", allow_module_level=True)
7074
71-
The imperative method is useful when it is not possible to evaluate the skip condition
72-
during import time.
7375
7476
**Reference**: :ref:`pytest.mark.skip ref`
7577

0 commit comments

Comments
 (0)