From 6b126997e117bb7085a7b3999c1d18cc262de793 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 20 Oct 2018 11:28:39 -0300 Subject: [PATCH] Remove pytest.config example from skipping at module level docs --- doc/en/skipping.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/en/skipping.rst b/doc/en/skipping.rst index dabc8a90f..f705422d8 100644 --- a/doc/en/skipping.rst +++ b/doc/en/skipping.rst @@ -58,18 +58,20 @@ by calling the ``pytest.skip(reason)`` function: if not valid_config(): 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 ``pytest.skip(reason, allow_module_level=True)`` at the module level: .. code-block:: python + import sys import pytest - if not pytest.config.getoption("--custom-flag"): - pytest.skip("--custom-flag is missing, skipping tests", allow_module_level=True) + if not sys.platform.startswith("win"): + 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`