MCPcopy Create free account
hub / github.com/pytest-dev/pytest / skip

Function skip

src/_pytest/outcomes.py:147–175  ·  view source on GitHub ↗

Skip an executing test with the given message. This function should be called only during testing (setup, call or teardown) or during collection by using the ``allow_module_level`` flag. This function can be called in doctests as well. :param reason: The message to show th

(
    reason: str = "", *, allow_module_level: bool = False, msg: Optional[str] = None
)

Source from the content-addressed store, hash-verified

145
146@_with_exception(Skipped)
147def skip(
148 reason: str = "", *, allow_module_level: bool = False, msg: Optional[str] = None
149) -> "NoReturn":
150 """Skip an executing test with the given message.
151
152 This function should be called only during testing (setup, call or teardown) or
153 during collection by using the ``allow_module_level`` flag. This function can
154 be called in doctests as well.
155
156 :param reason:
157 The message to show the user as reason for the skip.
158
159 :param allow_module_level:
160 Allows this function to be called at module level, skipping the rest
161 of the module. Defaults to False.
162
163 :param msg:
164 Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead.
165
166 .. note::
167 It is better to use the :ref:`pytest.mark.skipif ref` marker when
168 possible to declare a test to be skipped under certain conditions
169 like mismatching platforms or dependencies.
170 Similarly, use the ``# doctest: +SKIP`` directive (see :py:data:`doctest.SKIP`)
171 to skip a doctest statically.
172 """
173 __tracebackhide__ = True
174 reason = _resolve_msg_to_reason("skip", reason, msg)
175 raise Skipped(msg=reason, allow_module_level=allow_module_level)
176
177
178@_with_exception(Failed)

Callers 3

symlink_or_skipFunction · 0.90
spawnMethod · 0.90
async_warn_and_skipFunction · 0.90

Calls 2

_resolve_msg_to_reasonFunction · 0.85
SkippedClass · 0.85

Tested by 1

spawnMethod · 0.72