File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -58,18 +58,20 @@ by calling the ``pytest.skip(reason)`` function:
58
58
if not valid_config():
59
59
pytest.skip(" unsupported configuration" )
60
60
61
+ The imperative method is useful when it is not possible to evaluate the skip condition
62
+ during import time.
63
+
61
64
It is also possible to skip the whole module using
62
65
``pytest.skip(reason, allow_module_level=True) `` at the module level:
63
66
64
67
.. code-block :: python
65
68
69
+ import sys
66
70
import pytest
67
71
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 )
70
74
71
- The imperative method is useful when it is not possible to evaluate the skip condition
72
- during import time.
73
75
74
76
**Reference **: :ref: `pytest.mark.skip ref `
75
77
You can’t perform that action at this time.
0 commit comments