Skip to content

Commit 62f96ee

Browse files
committed
Include documentation
1 parent fa3cca5 commit 62f96ee

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ Steffen Allner
222222
Stephan Obermann
223223
Sven-Hendrik Haase
224224
Tadek Teleżyński
225+
Takafumi Arakaki
225226
Tarcisio Fischer
226227
Tareq Alayan
227228
Ted Xiao

changelog/4911.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Doctest can be now skipped dynamically with `pytest.skip`.

src/_pytest/outcomes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def skip(msg="", **kwargs):
8080
Skip an executing test with the given message.
8181
8282
This function should be called only during testing (setup, call or teardown) or
83-
during collection by using the ``allow_module_level`` flag.
83+
during collection by using the ``allow_module_level`` flag. This function can
84+
be called in doctest as well.
8485
8586
:kwarg bool allow_module_level: allows this function to be called at
8687
module level, skipping the rest of the module. Default to False.
@@ -89,6 +90,9 @@ def skip(msg="", **kwargs):
8990
It is better to use the :ref:`pytest.mark.skipif ref` marker when possible to declare a test to be
9091
skipped under certain conditions like mismatching platforms or
9192
dependencies.
93+
Similarly, use ``# doctest: +SKIP`` directive (see `doctest.SKIP
94+
<https://docs.python.org/3/library/doctest.html#doctest.SKIP>`_)
95+
to skip a doctest statically.
9296
"""
9397
__tracebackhide__ = True
9498
allow_module_level = kwargs.pop("allow_module_level", False)

0 commit comments

Comments
 (0)