Skip to content

Commit b2a8e06

Browse files
author
Joe Hamman
committed
add warning to skipping docs re marker inheritance
1 parent 09349c3 commit b2a8e06

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

doc/en/skipping.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ by calling the ``pytest.skip(reason)`` function:
5454
if not valid_config():
5555
pytest.skip("unsupported configuration")
5656
57-
The imperative method is useful when it is not possible to evaluate the skip condition
57+
The imperative method is useful when it is not possible to evaluate the skip condition
5858
during import time.
5959

6060
``skipif``
@@ -73,7 +73,7 @@ when run on a Python3.3 interpreter::
7373
...
7474

7575
If the condition evaluates to ``True`` during collection, the test function will be skipped,
76-
with the specified reason appearing in the summary when using ``-rs``.
76+
with the specified reason appearing in the summary when using ``-rs``.
7777

7878
You can share ``skipif`` markers between modules. Consider this test module::
7979

@@ -118,6 +118,12 @@ You can use the ``skipif`` marker (as any other marker) on classes::
118118
If the condition is ``True``, this marker will produce a skip result for
119119
each of the test methods of that class.
120120

121+
.. warning::
122+
123+
The use of ``skipif`` on classes that use inheritance is strongly
124+
discouraged. `A Known bug <https://github.com/pytest-dev/pytest/issues/568>`_
125+
in pytest's markers may cause unexpected behavior in super classes.
126+
121127
If you want to skip all test functions of a module, you may use
122128
the ``pytestmark`` name on the global level:
123129

@@ -305,12 +311,12 @@ Running it with the report-on-xfail option gives this output::
305311
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
306312
rootdir: $REGENDOC_TMPDIR/example, inifile:
307313
collected 7 items
308-
314+
309315
xfail_demo.py xxxxxxx
310316
======= short test summary info ========
311317
XFAIL xfail_demo.py::test_hello
312318
XFAIL xfail_demo.py::test_hello2
313-
reason: [NOTRUN]
319+
reason: [NOTRUN]
314320
XFAIL xfail_demo.py::test_hello3
315321
condition: hasattr(os, 'sep')
316322
XFAIL xfail_demo.py::test_hello4
@@ -320,7 +326,7 @@ Running it with the report-on-xfail option gives this output::
320326
XFAIL xfail_demo.py::test_hello6
321327
reason: reason
322328
XFAIL xfail_demo.py::test_hello7
323-
329+
324330
======= 7 xfailed in 0.12 seconds ========
325331

326332
.. _`skip/xfail with parametrize`:
@@ -346,5 +352,3 @@ test instances when using parametrize:
346352
])
347353
def test_increment(n, expected):
348354
assert n + 1 == expected
349-
350-

0 commit comments

Comments
 (0)