summaryrefslogtreecommitdiff
path: root/testing/test_skipping.py
diff options
context:
space:
mode:
authorBruno Oliveira <nicoddemus@gmail.com>2016-02-15 19:05:40 -0200
committerBruno Oliveira <nicoddemus@gmail.com>2016-02-15 19:18:48 -0200
commit0eeb466f11eb73f7c4801aa94326a99f337e0183 (patch)
tree429c55fe715f0307c6c254f87a24f38f0b02cfc2 /testing/test_skipping.py
parentee88679c540f1f387e50e76de470b2fd25f1036d (diff)
downloadpytest-0eeb466f11eb73f7c4801aa94326a99f337e0183.tar.gz
Fix strict xfail: it should behave exactly like xfail when a test fails
Diffstat (limited to 'testing/test_skipping.py')
-rw-r--r--testing/test_skipping.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/testing/test_skipping.py b/testing/test_skipping.py
index 227177eb0..6683aa200 100644
--- a/testing/test_skipping.py
+++ b/testing/test_skipping.py
@@ -127,13 +127,15 @@ class TestEvaluator:
class TestXFail:
- def test_xfail_simple(self, testdir):
+
+ @pytest.mark.parametrize('strict', [True, False])
+ def test_xfail_simple(self, testdir, strict):
item = testdir.getitem("""
import pytest
- @pytest.mark.xfail
+ @pytest.mark.xfail(strict=%s)
def test_func():
assert 0
- """)
+ """ % strict)
reports = runtestprotocol(item, log=False)
assert len(reports) == 3
callreport = reports[1]
@@ -350,6 +352,23 @@ class TestXFail:
matchline,
])
+ def test_strict_sanity(self, testdir):
+ """sanity check for xfail(strict=True): a failing test should behave
+ exactly like a normal xfail.
+ """
+ p = testdir.makepyfile("""
+ import pytest
+ @pytest.mark.xfail(reason='unsupported feature', strict=True)
+ def test_foo():
+ assert 0
+ """)
+ result = testdir.runpytest(p, '-rxX')
+ result.stdout.fnmatch_lines([
+ '*XFAIL*',
+ '*unsupported feature*',
+ ])
+ assert result.ret == 0
+
@pytest.mark.parametrize('strict', [True, False])
def test_strict_xfail(self, testdir, strict):
p = testdir.makepyfile("""