Fix pytest.mark.skip mark when used in strict mode
This commit is contained in:
parent
725290a8ab
commit
1fbd19b8cb
1
AUTHORS
1
AUTHORS
|
@ -69,6 +69,7 @@ Nicolas Delaby
|
||||||
Pieter Mulder
|
Pieter Mulder
|
||||||
Piotr Banaszkiewicz
|
Piotr Banaszkiewicz
|
||||||
Punyashloka Biswal
|
Punyashloka Biswal
|
||||||
|
Quentin Pradet
|
||||||
Ralf Schmitt
|
Ralf Schmitt
|
||||||
Raphael Pierzina
|
Raphael Pierzina
|
||||||
Ronny Pfannschmidt
|
Ronny Pfannschmidt
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
*
|
* Fix ``pytest.mark.skip`` mark when used in strict mode.
|
||||||
|
Thanks `@pquentin`_ for the PR and `@RonnyPfannschmidt`_ for
|
||||||
|
showing how to fix the bug.
|
||||||
|
|
||||||
* Minor improvements and fixes to the documentation.
|
* Minor improvements and fixes to the documentation.
|
||||||
Thanks `@omarkohl`_ for the PR.
|
Thanks `@omarkohl`_ for the PR.
|
||||||
|
@ -165,6 +167,7 @@
|
||||||
.. _@rabbbit: https://github.com/rabbbit
|
.. _@rabbbit: https://github.com/rabbbit
|
||||||
.. _@hackebrot: https://github.com/hackebrot
|
.. _@hackebrot: https://github.com/hackebrot
|
||||||
.. _@omarkohl: https://github.com/omarkohl
|
.. _@omarkohl: https://github.com/omarkohl
|
||||||
|
.. _@pquentin: https://github.com/pquentin
|
||||||
|
|
||||||
2.8.7
|
2.8.7
|
||||||
=====
|
=====
|
||||||
|
|
|
@ -30,6 +30,11 @@ def pytest_configure(config):
|
||||||
nop.Exception = XFailed
|
nop.Exception = XFailed
|
||||||
setattr(pytest, "xfail", nop)
|
setattr(pytest, "xfail", nop)
|
||||||
|
|
||||||
|
config.addinivalue_line("markers",
|
||||||
|
"skip(reason=None): skip the given test function with an optional reason. "
|
||||||
|
"Example: skip(reason=\"no way of currently testing this\") skips the "
|
||||||
|
"test."
|
||||||
|
)
|
||||||
config.addinivalue_line("markers",
|
config.addinivalue_line("markers",
|
||||||
"skipif(condition): skip the given test function if eval(condition) "
|
"skipif(condition): skip the given test function if eval(condition) "
|
||||||
"results in a True value. Evaluation happens within the "
|
"results in a True value. Evaluation happens within the "
|
||||||
|
|
|
@ -539,6 +539,19 @@ class TestSkip:
|
||||||
"*1 passed*2 skipped*",
|
"*1 passed*2 skipped*",
|
||||||
])
|
])
|
||||||
|
|
||||||
|
def test_strict_and_skip(self, testdir):
|
||||||
|
testdir.makepyfile("""
|
||||||
|
import pytest
|
||||||
|
@pytest.mark.skip
|
||||||
|
def test_hello():
|
||||||
|
pass
|
||||||
|
""")
|
||||||
|
result = testdir.runpytest("-rs --strict")
|
||||||
|
result.stdout.fnmatch_lines([
|
||||||
|
"*unconditional skip*",
|
||||||
|
"*1 skipped*",
|
||||||
|
])
|
||||||
|
|
||||||
class TestSkipif:
|
class TestSkipif:
|
||||||
def test_skipif_conditional(self, testdir):
|
def test_skipif_conditional(self, testdir):
|
||||||
item = testdir.getitem("""
|
item = testdir.getitem("""
|
||||||
|
|
Loading…
Reference in New Issue