22"""
33
44import pytest
5- from conftest import get_example , require_pytest_version
6-
7- require_pytest_version ("4.2.0" )
5+ from conftest import get_example
86
97
108def test_basic (ctestdir ):
@@ -13,9 +11,12 @@ def test_basic(ctestdir):
1311 with get_example ("basic.py" ).open ("rt" ) as f :
1412 ctestdir .makepyfile (f .read ())
1513 result = ctestdir .runpytest ("--verbose" )
16- result .assert_outcomes (passed = 2 , skipped = 2 , failed = 0 , xfailed = 1 )
14+ try :
15+ result .assert_outcomes (passed = 2 , skipped = 2 , failed = 0 , xfailed = 1 )
16+ except TypeError :
17+ result .assert_outcomes (passed = 2 , skipped = 2 , failed = 0 )
1718 result .stdout .re_match_lines (r"""
18- .*::test_a XFAIL(?:\s+\(.*\))?
19+ .*::test_a (?: XFAIL(?:\s+\(.*\))?|xfail)
1920 .*::test_b PASSED
2021 .*::test_c SKIPPED(?:\s+\(.*\))?
2122 .*::test_d PASSED
@@ -29,9 +30,12 @@ def test_named(ctestdir):
2930 with get_example ("named.py" ).open ("rt" ) as f :
3031 ctestdir .makepyfile (f .read ())
3132 result = ctestdir .runpytest ("--verbose" )
32- result .assert_outcomes (passed = 2 , skipped = 2 , failed = 0 , xfailed = 1 )
33+ try :
34+ result .assert_outcomes (passed = 2 , skipped = 2 , failed = 0 , xfailed = 1 )
35+ except TypeError :
36+ result .assert_outcomes (passed = 2 , skipped = 2 , failed = 0 )
3337 result .stdout .re_match_lines (r"""
34- .*::test_a XFAIL(?:\s+\(.*\))?
38+ .*::test_a (?: XFAIL(?:\s+\(.*\))?|xfail)
3539 .*::test_b PASSED
3640 .*::test_c SKIPPED(?:\s+\(.*\))?
3741 .*::test_d PASSED
@@ -45,14 +49,17 @@ def test_testclass(ctestdir):
4549 with get_example ("testclass.py" ).open ("rt" ) as f :
4650 ctestdir .makepyfile (f .read ())
4751 result = ctestdir .runpytest ("--verbose" )
48- result .assert_outcomes (passed = 4 , skipped = 4 , failed = 0 , xfailed = 2 )
52+ try :
53+ result .assert_outcomes (passed = 4 , skipped = 4 , failed = 0 , xfailed = 2 )
54+ except TypeError :
55+ result .assert_outcomes (passed = 4 , skipped = 4 , failed = 0 )
4956 result .stdout .re_match_lines (r"""
50- .*::TestClass::test_a XFAIL(?:\s+\(.*\))?
57+ .*::TestClass::test_a (?: XFAIL(?:\s+\(.*\))?|xfail)
5158 .*::TestClass::test_b PASSED
5259 .*::TestClass::test_c SKIPPED(?:\s+\(.*\))?
5360 .*::TestClass::test_d PASSED
5461 .*::TestClass::test_e SKIPPED(?:\s+\(.*\))?
55- .*::TestClassNamed::test_a XFAIL(?:\s+\(.*\))?
62+ .*::TestClassNamed::test_a (?: XFAIL(?:\s+\(.*\))?|xfail)
5663 .*::TestClassNamed::test_b PASSED
5764 .*::TestClassNamed::test_c SKIPPED(?:\s+\(.*\))?
5865 .*::TestClassNamed::test_d PASSED
@@ -66,10 +73,13 @@ def test_parametrized(ctestdir):
6673 with get_example ("parametrized.py" ).open ("rt" ) as f :
6774 ctestdir .makepyfile (f .read ())
6875 result = ctestdir .runpytest ("--verbose" )
69- result .assert_outcomes (passed = 7 , skipped = 5 , failed = 0 , xfailed = 1 )
76+ try :
77+ result .assert_outcomes (passed = 7 , skipped = 5 , failed = 0 , xfailed = 1 )
78+ except TypeError :
79+ result .assert_outcomes (passed = 7 , skipped = 5 , failed = 0 )
7080 result .stdout .re_match_lines (r"""
7181 .*::test_a\[0-0\] PASSED
72- .*::test_a\[0-1\] XFAIL(?:\s+\(.*\))?
82+ .*::test_a\[0-1\] (?: XFAIL(?:\s+\(.*\))?|xfail)
7383 .*::test_a\[1-0\] PASSED
7484 .*::test_a\[1-1\] PASSED
7585 .*::test_b\[1-2\] SKIPPED(?:\s+\(.*\))?
@@ -90,10 +100,13 @@ def test_runtime(ctestdir):
90100 with get_example ("runtime.py" ).open ("rt" ) as f :
91101 ctestdir .makepyfile (f .read ())
92102 result = ctestdir .runpytest ("--verbose" )
93- result .assert_outcomes (passed = 1 , skipped = 2 , failed = 0 , xfailed = 1 )
103+ try :
104+ result .assert_outcomes (passed = 1 , skipped = 2 , failed = 0 , xfailed = 1 )
105+ except TypeError :
106+ result .assert_outcomes (passed = 1 , skipped = 2 , failed = 0 )
94107 result .stdout .re_match_lines (r"""
95108 .*::test_a PASSED
96- .*::test_b XFAIL(?:\s+\(.*\))?
109+ .*::test_b (?: XFAIL(?:\s+\(.*\))?|xfail)
97110 .*::test_c SKIPPED(?:\s+\(.*\))?
98111 .*::test_d SKIPPED(?:\s+\(.*\))?
99112 """ )
0 commit comments