Skip to content

Commit 8942b07

Browse files
committed
TST: Use new method for applying pytest markers.
1 parent dcbae6a commit 8942b07

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

lib/matplotlib/testing/decorators.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -159,20 +159,24 @@ def _xfail_if_format_is_uncomparable(extension):
159159
def _mark_xfail_if_format_is_uncomparable(extension):
160160
if isinstance(extension, str):
161161
name = extension
162+
marks = []
162163
elif isinstance(extension, tuple):
163164
# Extension might be a pytest ParameterSet instead of a plain string.
164165
# Unfortunately, this type is not exposed, so since it's a namedtuple,
165166
# check for a tuple instead.
166167
name = extension.values[0]
168+
marks = list(extension.marks)
167169
else:
168170
# Extension might be a pytest marker instead of a plain string.
169171
name = extension.args[0]
172+
marks = [extension.mark]
170173

171174
if name not in comparable_formats():
172175
fail_msg = 'Cannot compare %s files on this system' % (name, )
173176
import pytest
174-
return pytest.mark.xfail(extension, reason=fail_msg, strict=False,
175-
raises=ImageComparisonFailure)
177+
marks += [pytest.mark.xfail(reason=fail_msg, strict=False,
178+
raises=ImageComparisonFailure)]
179+
return pytest.param(name, marks=marks)
176180
else:
177181
return extension
178182

lib/mpl_toolkits/tests/test_mplot3d.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ def test_lines3d():
133133

134134

135135
# Reason for flakiness of SVG test is still unknown.
136-
@image_comparison(baseline_images=['mixedsubplot'], remove_text=True,
137-
extensions=['png', 'pdf',
138-
pytest.mark.xfail('svg', strict=False)])
136+
@image_comparison(
137+
baseline_images=['mixedsubplot'], remove_text=True,
138+
extensions=['png', 'pdf',
139+
pytest.param('svg', marks=pytest.mark.xfail(strict=False))])
139140
def test_mixedsubplots():
140141
def f(t):
141142
s1 = np.cos(2*np.pi*t)

0 commit comments

Comments
 (0)