Add a note about pytest.skip not being allowed at module level

This commit is contained in:
Bruno Oliveira 2016-09-24 07:55:34 -03:00
parent 8dc497b54b
commit 94155ee62a
1 changed files with 12 additions and 0 deletions

View File

@ -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
--------------------------------------------------