File tree Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -588,23 +588,37 @@ def test_hello(self, arg1):
588
588
assert result .ret == 1
589
589
590
590
@pytest .mark .skipif ("sys.version_info < (2,7)" )
591
- def test_unittest_unexpected_failure (testdir ):
591
+ def test_unittest_expected_failure_for_failing_test_is_xfail (testdir ):
592
592
testdir .makepyfile ("""
593
593
import unittest
594
594
class MyTestCase(unittest.TestCase):
595
595
@unittest.expectedFailure
596
- def test_func1(self):
597
- assert 0
596
+ def test_failing_test_is_xfail(self):
597
+ assert False
598
+ """ )
599
+ result = testdir .runpytest ("-rxX" )
600
+ result .stdout .fnmatch_lines ([
601
+ "*XFAIL*MyTestCase*test_failing_test_is_xfail*" ,
602
+ "*1 xfailed*" ,
603
+ ])
604
+ assert result .ret == 0
605
+
606
+ @pytest .mark .skipif ("sys.version_info < (2,7)" )
607
+ def test_unittest_expected_failure_for_passing_test_is_fail (testdir ):
608
+ testdir .makepyfile ("""
609
+ import unittest
610
+ class MyTestCase(unittest.TestCase):
598
611
@unittest.expectedFailure
599
- def test_func2 (self):
600
- assert 1
612
+ def test_passing_test_is_fail (self):
613
+ assert True
601
614
""" )
602
615
result = testdir .runpytest ("-rxX" )
603
616
result .stdout .fnmatch_lines ([
604
- "*XFAIL*MyTestCase*test_func1 *" ,
605
- "*XPASS* MyTestCase*test_func2 *" ,
606
- "*1 xfailed*1 xpass *" ,
617
+ "*FAILURES *" ,
618
+ "*MyTestCase*test_passing_test_is_fail *" ,
619
+ "*1 failed *" ,
607
620
])
621
+ assert result .ret == 1
608
622
609
623
610
624
@pytest .mark .parametrize ('fix_type, stmt' , [
You can’t perform that action at this time.
0 commit comments