File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -438,6 +438,28 @@ def test_lastfailed_creates_cache_when_needed(self, testdir):
438
438
testdir .runpytest ('-q' , '--lf' )
439
439
assert os .path .exists ('.cache' )
440
440
441
+ def test_xfail_not_considered_failure (self , testdir ):
442
+ testdir .makepyfile ('''
443
+ import pytest
444
+ @pytest.mark.xfail
445
+ def test():
446
+ assert 0
447
+ ''' )
448
+ result = testdir .runpytest ()
449
+ result .stdout .fnmatch_lines ('*1 xfailed*' )
450
+ assert self .get_cached_last_failed (testdir ) == []
451
+
452
+ def test_xfail_strict_considered_failure (self , testdir ):
453
+ testdir .makepyfile ('''
454
+ import pytest
455
+ @pytest.mark.xfail(strict=True)
456
+ def test():
457
+ pass
458
+ ''' )
459
+ result = testdir .runpytest ()
460
+ result .stdout .fnmatch_lines ('*1 failed*' )
461
+ assert self .get_cached_last_failed (testdir ) == ['test_xfail_strict_considered_failure.py::test' ]
462
+
441
463
def get_cached_last_failed (self , testdir ):
442
464
config = testdir .parseconfigure ()
443
465
return sorted (config .cache .get ("cache/lastfailed" , {}))
You can’t perform that action at this time.
0 commit comments