File tree 3 files changed +23
-1
lines changed
3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 6
6
* fix `#510 `_: skip tests where one parameterize dimension was empty
7
7
thanks Alex Stapleton for the Report and `@RonnyPfannschmidt `_ for the PR
8
8
9
+ * Fix Xfail does not work with condition keyword argument.
10
+ Thanks `@astraw38 `_ for reporting the issue (`#1496 `_) and `@tomviner `_
11
+ for PR the (`#1524 `_).
12
+
9
13
* Fix win32 path issue when puttinging custom config file with absolute path
10
14
in ``pytest.main("-c your_absolute_path") ``.
11
15
22
26
23
27
.. _#510 : https://github.com/pytest-dev/pytest/issues/510
24
28
.. _#1506 : https://github.com/pytest-dev/pytest/pull/1506
29
+ .. _#1496 : https://github.com/pytest-dev/pytest/issue/1496
30
+ .. _#1524 : https://github.com/pytest-dev/pytest/issue/1524
25
31
26
32
.. _@prusse-martin : https://github.com/prusse-martin
33
+ .. _@astraw38 : https://github.com/astraw38
27
34
28
35
29
36
2.9.1
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ def _istrue(self):
120
120
return self .result
121
121
if self .holder :
122
122
d = self ._getglobals ()
123
- if self .holder .args :
123
+ if self .holder .args or 'condition' in self . holder . kwargs :
124
124
self .result = False
125
125
# "holder" might be a MarkInfo or a MarkDecorator; only
126
126
# MarkInfo keeps track of all parameters it received in an
@@ -130,6 +130,8 @@ def _istrue(self):
130
130
else :
131
131
arglist = [(self .holder .args , self .holder .kwargs )]
132
132
for args , kwargs in arglist :
133
+ if 'condition' in kwargs :
134
+ args = (kwargs ['condition' ],)
133
135
for expr in args :
134
136
self .expr = expr
135
137
if isinstance (expr , py .builtin ._basestring ):
Original file line number Diff line number Diff line change @@ -405,6 +405,19 @@ def test_foo():
405
405
result .stdout .fnmatch_lines ('*1 passed*' )
406
406
assert result .ret == 0
407
407
408
+ @pytest .mark .parametrize ('strict' , [True , False ])
409
+ def test_xfail_condition_keyword (self , testdir , strict ):
410
+ p = testdir .makepyfile ("""
411
+ import pytest
412
+
413
+ @pytest.mark.xfail(condition=False, reason='unsupported feature', strict=%s)
414
+ def test_foo():
415
+ pass
416
+ """ % strict )
417
+ result = testdir .runpytest (p , '-rxX' )
418
+ result .stdout .fnmatch_lines ('*1 passed*' )
419
+ assert result .ret == 0
420
+
408
421
@pytest .mark .parametrize ('strict_val' , ['true' , 'false' ])
409
422
def test_strict_xfail_default_from_file (self , testdir , strict_val ):
410
423
testdir .makeini ('''
You can’t perform that action at this time.
0 commit comments