@@ -67,13 +67,19 @@ def exit(msg):
6767
6868
6969def skip (msg = "" , ** kwargs ):
70- """ skip an executing test with the given message. Note: it's usually
71- better to use the pytest.mark.skipif marker to declare a test to be
72- skipped under certain conditions like mismatching platforms or
73- dependencies. See the pytest_skipping plugin for details.
70+ """
71+ Skip an executing test with the given message.
72+
73+ This function should be called only during testing (setup, call or teardown) or
74+ during collection by using the ``allow_module_level`` flag.
7475
7576 :kwarg bool allow_module_level: allows this function to be called at
7677 module level, skipping the rest of the module. Default to False.
78+
79+ .. note::
80+ It is better to use the :ref:`pytest.mark.skipif ref` marker when possible to declare a test to be
81+ skipped under certain conditions like mismatching platforms or
82+ dependencies.
7783 """
7884 __tracebackhide__ = True
7985 allow_module_level = kwargs .pop ("allow_module_level" , False )
@@ -87,10 +93,12 @@ def skip(msg="", **kwargs):
8793
8894
8995def fail (msg = "" , pytrace = True ):
90- """ explicitly fail a currently-executing test with the given Message.
96+ """
97+ Explicitly fail an executing test with the given message.
9198
92- :arg pytrace: if false the msg represents the full failure information
93- and no python traceback will be reported.
99+ :param str msg: the message to show the user as reason for the failure.
100+ :param bool pytrace: if false the msg represents the full failure information and no
101+ python traceback will be reported.
94102 """
95103 __tracebackhide__ = True
96104 raise Failed (msg = msg , pytrace = pytrace )
@@ -104,7 +112,15 @@ class XFailed(fail.Exception):
104112
105113
106114def xfail (reason = "" ):
107- """ xfail an executing test or setup functions with the given reason."""
115+ """
116+ Imperatively xfail an executing test or setup functions with the given reason.
117+
118+ This function should be called only during testing (setup, call or teardown).
119+
120+ .. note::
121+ It is better to use the :ref:`pytest.mark.xfail ref` marker when possible to declare a test to be
122+ xfailed under certain conditions like known bugs or missing features.
123+ """
108124 __tracebackhide__ = True
109125 raise XFailed (reason )
110126
0 commit comments