Skip to content

Commit f4b430f

Browse files
QuLogicArchangeGabriel
authored andcommitted
Handle pytest's new ParameterSet for markers.
Using pytest.param(..., marks=pytest.mark.something) is a different type than if using pytest.mark.something(...), so we need to handle that case on skipping extensions.
1 parent 7c4f28c commit f4b430f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/matplotlib/testing/decorators.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,18 @@ def _xfail_if_format_is_uncomparable(extension):
223223

224224
def _mark_xfail_if_format_is_uncomparable(extension):
225225
if isinstance(extension, six.string_types):
226-
will_fail = extension not in comparable_formats()
226+
name = extension
227+
elif isinstance(extension, tuple):
228+
# Extension might be a pytest ParameterSet instead of a plain string.
229+
# Unfortunately, this type is not exposed, so since it's a namedtuple,
230+
# check for a tuple instead.
231+
name = extension.values[0]
227232
else:
228233
# Extension might be a pytest marker instead of a plain string.
229-
will_fail = extension.args[0] not in comparable_formats()
230-
if will_fail:
231-
fail_msg = 'Cannot compare %s files on this system' % extension
234+
name = extension.args[0]
235+
236+
if name not in comparable_formats():
237+
fail_msg = 'Cannot compare %s files on this system' % (name, )
232238
import pytest
233239
return pytest.mark.xfail(extension, reason=fail_msg, strict=False,
234240
raises=ImageComparisonFailure)

0 commit comments

Comments
 (0)