From 94155ee62ad53995c39a5d98aa799305ebb333ea Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 24 Sep 2016 07:55:34 -0300 Subject: [PATCH] Add a note about pytest.skip not being allowed at module level --- doc/en/skipping.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/en/skipping.rst b/doc/en/skipping.rst index dde89705e..662fed5df 100644 --- a/doc/en/skipping.rst +++ b/doc/en/skipping.rst @@ -293,6 +293,18 @@ imperatively, in test or setup code:: # or pytest.skip("unsupported configuration") +Note that calling ``pytest.skip`` at the module level +is not allowed since pytest 3.0. To skip +all tests in a module given some runtime condition, you can +set a ``pytestmark`` variable: + +.. code-block:: python + + if SOME_CONDITION: + pytestmark = pytest.mark.skip('skipping all tests because SOME_CONDITION') + +``pytestmark`` applies a mark or list of marks to all tests in a module. + Skipping on a missing import dependency --------------------------------------------------