File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -145,15 +145,29 @@ def test_func():
145
145
def test_xfail_xpassed (self , testdir ):
146
146
item = testdir .getitem ("""
147
147
import pytest
148
- @pytest.mark.xfail
148
+ @pytest.mark.xfail(reason="nope")
149
+ def test_func():
150
+ assert 1
151
+ """ )
152
+ reports = runtestprotocol (item , log = False )
153
+ assert len (reports ) == 3
154
+ callreport = reports [1 ]
155
+ assert callreport .passed
156
+ assert callreport .wasxfail == "nope"
157
+
158
+ def test_xfail_xpassed_strict (self , testdir ):
159
+ item = testdir .getitem ("""
160
+ import pytest
161
+ @pytest.mark.xfail(strict=True, reason="nope")
149
162
def test_func():
150
163
assert 1
151
164
""" )
152
165
reports = runtestprotocol (item , log = False )
153
166
assert len (reports ) == 3
154
167
callreport = reports [1 ]
155
168
assert callreport .failed
156
- assert callreport .wasxfail == ""
169
+ assert callreport .longrepr == "[XPASS(strict)] nope"
170
+ assert not hasattr (callreport , "wasxfail" )
157
171
158
172
def test_xfail_run_anyway (self , testdir ):
159
173
testdir .makepyfile ("""
You can’t perform that action at this time.
0 commit comments