diff --git a/lib/matplotlib/testing/__init__.py b/lib/matplotlib/testing/__init__.py index 610977fd4664..4cdfe4bd8b9e 100644 --- a/lib/matplotlib/testing/__init__.py +++ b/lib/matplotlib/testing/__init__.py @@ -20,30 +20,8 @@ def is_called_from_pytest(): return getattr(matplotlib, '_called_from_pytest', False) -def xfail(msg=""): - """Explicitly fail an currently-executing test with the given message.""" - __tracebackhide__ = True - if is_called_from_pytest(): - import pytest - pytest.xfail(msg) - else: - from .nose import knownfail - knownfail(msg) - - -def skip(msg=""): - """Skip an executing test with the given message.""" - __tracebackhide__ = True - if is_called_from_pytest(): - import pytest - pytest.skip(msg) - else: - from nose import SkipTest - raise SkipTest(msg) - - # stolen from pytest -def getrawcode(obj, trycall=True): +def _getrawcode(obj, trycall=True): """Return code object for given function.""" try: return obj.__code__ @@ -60,7 +38,7 @@ def getrawcode(obj, trycall=True): return obj -def copy_metadata(src_func, tgt_func): +def _copy_metadata(src_func, tgt_func): """Replicates metadata of the function. Returns target function.""" tgt_func.__dict__.update(src_func.__dict__) tgt_func.__doc__ = src_func.__doc__ @@ -69,7 +47,7 @@ def copy_metadata(src_func, tgt_func): if hasattr(src_func, '__qualname__'): tgt_func.__qualname__ = src_func.__qualname__ if not hasattr(tgt_func, 'compat_co_firstlineno'): - tgt_func.compat_co_firstlineno = getrawcode(src_func).co_firstlineno + tgt_func.compat_co_firstlineno = _getrawcode(src_func).co_firstlineno return tgt_func diff --git a/lib/matplotlib/testing/_nose/decorators.py b/lib/matplotlib/testing/_nose/decorators.py index d6456b76424e..e6e2eb4dc847 100644 --- a/lib/matplotlib/testing/_nose/decorators.py +++ b/lib/matplotlib/testing/_nose/decorators.py @@ -4,50 +4,11 @@ import os import six import sys -from .. import copy_metadata, skip +from .. import _copy_metadata from . import knownfail from .exceptions import KnownFailureDidNotFailTest -def skipif(skip_condition, *args, **kwargs): - if isinstance(skip_condition, bool) and 'reason' not in kwargs: - raise ValueError("you need to specify reason=STRING " - "when using booleans as conditions.") - - def skip_decorator(func): - import inspect - - def skipper(*_args, **_kwargs): - condition, msg = skip_condition, kwargs.get('reason') # local copy - if isinstance(condition, six.string_types): - globs = {'os': os, 'sys': sys} - try: - globs.update(func.__globals__) - except AttributeError: - globs.update(func.func_globals) - if msg is None: - msg = condition - condition = eval(condition, globs) - else: - condition = bool(condition) - - if condition: - skip(msg) - else: - return func(*_args, **_kwargs) - - if inspect.isclass(func): - setup = getattr(func, 'setup_class', classmethod(lambda _: None)) - setup = skip_decorator(setup.__func__) - setup = setup.__get__(func) - setattr(func, 'setup_class', setup) - return func - - return copy_metadata(func, skipper) - - return skip_decorator - - def knownfailureif(fail_condition, msg=None, known_exception_class=None): # based on numpy.testing.dec.knownfailureif if msg is None: @@ -70,5 +31,5 @@ def failer(*args, **kwargs): if fail_condition and fail_condition != 'indeterminate': raise KnownFailureDidNotFailTest(msg) return result - return copy_metadata(f, failer) + return _copy_metadata(f, failer) return known_fail_decorator diff --git a/lib/matplotlib/testing/compare.py b/lib/matplotlib/testing/compare.py index 122b6fd4a677..1c4d3d97b211 100644 --- a/lib/matplotlib/testing/compare.py +++ b/lib/matplotlib/testing/compare.py @@ -174,8 +174,14 @@ def convert(filename, cache): """ base, extension = filename.rsplit('.', 1) if extension not in converter: - from nose import SkipTest - raise SkipTest("Don't know how to convert %s files to png" % extension) + reason = "Don't know how to convert %s files to png" % extension + from . import is_called_from_pytest + if is_called_from_pytest(): + import pytest + pytest.skip(reason) + else: + from nose import SkipTest + raise SkipTest(reason) newname = base + '_' + extension + '.png' if not os.path.exists(filename): raise IOError("'%s' does not exist" % filename) diff --git a/lib/matplotlib/testing/decorators.py b/lib/matplotlib/testing/decorators.py index 8ab7e848945f..50f37f006a01 100644 --- a/lib/matplotlib/testing/decorators.py +++ b/lib/matplotlib/testing/decorators.py @@ -26,25 +26,11 @@ from matplotlib import ft2font from matplotlib.testing.compare import comparable_formats, compare_images, \ make_test_filename -from . import copy_metadata, is_called_from_pytest, xfail +from . import _copy_metadata, is_called_from_pytest from .exceptions import ImageComparisonFailure -def skipif(condition, *args, **kwargs): - """Skip the given test function if eval(condition) results in a True - value. - - Optionally specify a reason for better reporting. - """ - if is_called_from_pytest(): - import pytest - return pytest.mark.skipif(condition, *args, **kwargs) - else: - from ._nose.decorators import skipif - return skipif(condition, *args, **kwargs) - - -def knownfailureif(fail_condition, msg=None, known_exception_class=None): +def _knownfailureif(fail_condition, msg=None, known_exception_class=None): """ Assume a will fail if *fail_condition* is True. *fail_condition* @@ -69,6 +55,12 @@ def knownfailureif(fail_condition, msg=None, known_exception_class=None): return knownfailureif(fail_condition, msg, known_exception_class) +@cbook.deprecated('2.1', + alternative='pytest.xfail or import the plugin') +def knownfailureif(fail_condition, msg=None, known_exception_class=None): + _knownfailureif(fail_condition, msg, known_exception_class) + + def _do_cleanup(original_units_registry, original_settings): plt.close('all') @@ -175,15 +167,15 @@ def check_freetype_version(ver): return found >= ver[0] and found <= ver[1] -def checked_on_freetype_version(required_freetype_version): +def _checked_on_freetype_version(required_freetype_version): if check_freetype_version(required_freetype_version): return lambda f: f reason = ("Mismatched version of freetype. " "Test requires '%s', you have '%s'" % (required_freetype_version, ft2font.__freetype_version__)) - return knownfailureif('indeterminate', msg=reason, - known_exception_class=ImageComparisonFailure) + return _knownfailureif('indeterminate', msg=reason, + known_exception_class=ImageComparisonFailure) def remove_ticks_and_titles(figure): @@ -202,7 +194,7 @@ def remove_ticks_and_titles(figure): pass -def raise_on_image_difference(expected, actual, tol): +def _raise_on_image_difference(expected, actual, tol): __tracebackhide__ = True err = compare_images(expected, actual, tol, in_decorator=True) @@ -216,18 +208,18 @@ def raise_on_image_difference(expected, actual, tol): '(RMS %(rms).3f)' % err) -def xfail_if_format_is_uncomparable(extension): +def _xfail_if_format_is_uncomparable(extension): will_fail = extension not in comparable_formats() if will_fail: fail_msg = 'Cannot compare %s files on this system' % extension else: fail_msg = 'No failure expected' - return knownfailureif(will_fail, fail_msg, - known_exception_class=ImageComparisonFailure) + return _knownfailureif(will_fail, fail_msg, + known_exception_class=ImageComparisonFailure) -def mark_xfail_if_format_is_uncomparable(extension): +def _mark_xfail_if_format_is_uncomparable(extension): will_fail = extension not in comparable_formats() if will_fail: fail_msg = 'Cannot compare %s files on this system' % extension @@ -284,9 +276,15 @@ def copy_baseline(self, baseline, extension): if os.path.exists(orig_expected_fname): shutil.copyfile(orig_expected_fname, expected_fname) else: - xfail("Do not have baseline image {0} because this " - "file does not exist: {1}".format(expected_fname, - orig_expected_fname)) + reason = ("Do not have baseline image {0} because this " + "file does not exist: {1}".format(expected_fname, + orig_expected_fname)) + if is_called_from_pytest(): + import pytest + pytest.xfail(reason) + else: + from ._nose import knownfail + knownfail(reason) return expected_fname def compare(self, idx, baseline, extension): @@ -306,12 +304,12 @@ def compare(self, idx, baseline, extension): fig.savefig(actual_fname, **kwargs) expected_fname = self.copy_baseline(baseline, extension) - raise_on_image_difference(expected_fname, actual_fname, self.tol) + _raise_on_image_difference(expected_fname, actual_fname, self.tol) def nose_runner(self): func = self.compare - func = checked_on_freetype_version(self.freetype_version)(func) - funcs = {extension: xfail_if_format_is_uncomparable(extension)(func) + func = _checked_on_freetype_version(self.freetype_version)(func) + funcs = {extension: _xfail_if_format_is_uncomparable(extension)(func) for extension in self.extensions} for idx, baseline in enumerate(self.baseline_images): for extension in self.extensions: @@ -320,19 +318,20 @@ def nose_runner(self): def pytest_runner(self): from pytest import mark - extensions = map(mark_xfail_if_format_is_uncomparable, self.extensions) + extensions = map(_mark_xfail_if_format_is_uncomparable, + self.extensions) if len(set(self.baseline_images)) == len(self.baseline_images): @mark.parametrize("extension", extensions) @mark.parametrize("idx,baseline", enumerate(self.baseline_images)) - @checked_on_freetype_version(self.freetype_version) + @_checked_on_freetype_version(self.freetype_version) def wrapper(idx, baseline, extension): __tracebackhide__ = True self.compare(idx, baseline, extension) else: # Some baseline images are repeated, so run this in serial. @mark.parametrize("extension", extensions) - @checked_on_freetype_version(self.freetype_version) + @_checked_on_freetype_version(self.freetype_version) def wrapper(extension): __tracebackhide__ = True for idx, baseline in enumerate(self.baseline_images): @@ -348,7 +347,7 @@ def wrapper(extension): def __call__(self, func): self.delayed_init(func) if is_called_from_pytest(): - return copy_metadata(func, self.pytest_runner()) + return _copy_metadata(func, self.pytest_runner()) else: import nose.tools @@ -361,7 +360,7 @@ def runner_wrapper(): # nose bug... self.teardown() - return copy_metadata(func, runner_wrapper) + return _copy_metadata(func, runner_wrapper) def image_comparison(baseline_images=None, extensions=None, tol=0, @@ -497,7 +496,7 @@ def backend_switcher(*args, **kwargs): plt.switch_backend(prev_backend) return result - return copy_metadata(func, backend_switcher) + return _copy_metadata(func, backend_switcher) return switch_backend_decorator @@ -516,6 +515,7 @@ def skip_if_command_unavailable(cmd): try: check_output(cmd) except: - return skipif(True, reason='missing command: %s' % cmd[0]) + import pytest + return pytest.mark.skip(reason='missing command: %s' % cmd[0]) return lambda f: f diff --git a/lib/matplotlib/tests/test_agg.py b/lib/matplotlib/tests/test_agg.py index 0127eb09b909..a4b1a0da58da 100644 --- a/lib/matplotlib/tests/test_agg.py +++ b/lib/matplotlib/tests/test_agg.py @@ -11,7 +11,6 @@ from matplotlib.image import imread from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure -from matplotlib.testing import skip from matplotlib.testing.decorators import cleanup, image_comparison from matplotlib import pyplot as plt from matplotlib import collections @@ -180,9 +179,6 @@ def process_image(self, padded_src, dpi): t2 = self.offset_filter.process_image(t1, dpi) return t2 - if LooseVersion(np.__version__) < LooseVersion('1.7.0'): - skip('Disabled on Numpy < 1.7.0') - fig = plt.figure() ax = fig.add_subplot(111) diff --git a/lib/matplotlib/tests/test_animation.py b/lib/matplotlib/tests/test_animation.py index 057913cb185b..9d0fa59445e0 100644 --- a/lib/matplotlib/tests/test_animation.py +++ b/lib/matplotlib/tests/test_animation.py @@ -13,7 +13,6 @@ import matplotlib as mpl from matplotlib import pyplot as plt from matplotlib import animation -from matplotlib.testing import xfail, skip from matplotlib.testing.decorators import cleanup @@ -121,7 +120,7 @@ def test_save_animation_smoketest(tmpdir, writer, extension): except AttributeError: pass if not animation.writers.is_available(writer): - skip("writer '%s' not available on this system" % writer) + pytest.skip("writer '%s' not available on this system" % writer) fig, ax = plt.subplots() line, = ax.plot([], []) @@ -145,8 +144,8 @@ def animate(i): try: anim.save('movie.' + extension, fps=30, writer=writer, bitrate=500) except UnicodeDecodeError: - xfail("There can be errors in the numpy import stack, " - "see issues #1891 and #2679") + pytest.xfail("There can be errors in the numpy import stack, " + "see issues #1891 and #2679") @cleanup diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index dacbf6987423..8fbfbe20e1c7 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -21,7 +21,6 @@ import matplotlib from matplotlib.testing.decorators import image_comparison, cleanup -from matplotlib.testing import skip import matplotlib.pyplot as plt import matplotlib.markers as mmarkers import matplotlib.patches as mpatches @@ -90,7 +89,7 @@ def test_formatter_ticker(): def test_formatter_large_small(): # github issue #617, pull #619 if LooseVersion(np.__version__) >= LooseVersion('1.11.0'): - skip("Fall out from a fixed numpy bug") + pytest.skip("Fall out from a fixed numpy bug") fig, ax = plt.subplots(1) x = [0.500000001, 0.500000002] y = [1e64, 1.1e64] diff --git a/lib/matplotlib/tests/test_backend_pdf.py b/lib/matplotlib/tests/test_backend_pdf.py index ee4f54620f80..a7dfba557e5d 100644 --- a/lib/matplotlib/tests/test_backend_pdf.py +++ b/lib/matplotlib/tests/test_backend_pdf.py @@ -17,11 +17,15 @@ from matplotlib import pyplot as plt from matplotlib.testing.determinism import (_determinism_source_date_epoch, _determinism_check) -from matplotlib.testing.decorators import (image_comparison, knownfailureif, - cleanup) +from matplotlib.testing.decorators import image_comparison, cleanup from matplotlib import dviread +needs_tex = pytest.mark.xfail( + not checkdep_tex(), + reason="This test needs a TeX installation") + + @image_comparison(baseline_images=['pdf_use14corefonts'], extensions=['pdf']) def test_use14corefonts(): @@ -43,10 +47,6 @@ def test_use14corefonts(): fontsize=14) ax.axhline(0.5, linewidth=0.5) -needs_tex = knownfailureif( - not checkdep_tex(), - "This test needs a TeX installation") - @cleanup def test_type42(): diff --git a/lib/matplotlib/tests/test_backend_ps.py b/lib/matplotlib/tests/test_backend_ps.py index 40070979cdf9..65fe0e192cfc 100644 --- a/lib/matplotlib/tests/test_backend_ps.py +++ b/lib/matplotlib/tests/test_backend_ps.py @@ -5,7 +5,9 @@ import io import re + import numpy as np +import pytest import six import matplotlib @@ -13,17 +15,17 @@ from matplotlib import patheffects from matplotlib.testing.determinism import (_determinism_source_date_epoch, _determinism_check) -from matplotlib.testing.decorators import cleanup, knownfailureif +from matplotlib.testing.decorators import cleanup -needs_ghostscript = knownfailureif( +needs_ghostscript = pytest.mark.xfail( matplotlib.checkdep_ghostscript()[0] is None, - "This test needs a ghostscript installation") + reason="This test needs a ghostscript installation") -needs_tex = knownfailureif( +needs_tex = pytest.mark.xfail( not matplotlib.checkdep_tex(), - "This test needs a TeX installation") + reason="This test needs a TeX installation") def _test_savefig_to_stringio(format='ps', use_log=False): diff --git a/lib/matplotlib/tests/test_backend_svg.py b/lib/matplotlib/tests/test_backend_svg.py index e743af2dfa50..57f1af866e7a 100644 --- a/lib/matplotlib/tests/test_backend_svg.py +++ b/lib/matplotlib/tests/test_backend_svg.py @@ -13,14 +13,14 @@ import matplotlib.pyplot as plt from matplotlib.testing.decorators import cleanup -from matplotlib.testing.decorators import image_comparison, knownfailureif +from matplotlib.testing.decorators import image_comparison import matplotlib from matplotlib import dviread -needs_tex = knownfailureif( +needs_tex = pytest.mark.xfail( not matplotlib.checkdep_tex(), - "This test needs a TeX installation") + reason="This test needs a TeX installation") @cleanup diff --git a/lib/matplotlib/tests/test_basic.py b/lib/matplotlib/tests/test_basic.py index ee94f8926528..236e0d9e7d8d 100644 --- a/lib/matplotlib/tests/test_basic.py +++ b/lib/matplotlib/tests/test_basic.py @@ -4,59 +4,11 @@ import six import sys -from ..testing.decorators import knownfailureif, skipif - - -SKIPIF_CONDITION = [] - - -def setup_module(): - SKIPIF_CONDITION.append(None) - def test_simple(): assert 1 + 1 == 2 -@knownfailureif(True) -def test_simple_knownfail(): - # Test the known fail mechanism. - assert 1 + 1 == 3 - - -@skipif(True, reason="skipif decorator test with bool condition passed") -def test_skipif_bool(): - assert False, "skipif decorator does not work with bool condition" - - -@skipif('SKIPIF_CONDITION', - reason="skipif decorator test with string condition passed") -def test_skipif_string(): - assert False, "skipif decorator does not work with string condition" - - -@skipif(True, reason="skipif decorator on class test passed") -class Test_skipif_on_class(object): - def test(self): - assert False, "skipif decorator does not work on classes" - - -class Test_skipif_on_method(object): - @skipif(True, reason="skipif decorator on method test passed") - def test(self): - assert False, "skipif decorator does not work on methods" - - -@skipif(True, reason="skipif decorator on classmethod test passed") -class Test_skipif_on_classmethod(object): - @classmethod - def setup_class(cls): - pass - - def test(self): - assert False, "skipif decorator does not work on classmethods" - - def test_override_builtins(): import pylab diff --git a/lib/matplotlib/tests/test_coding_standards.py b/lib/matplotlib/tests/test_coding_standards.py index 8c1a8b08ee29..e5ea7420de0d 100644 --- a/lib/matplotlib/tests/test_coding_standards.py +++ b/lib/matplotlib/tests/test_coding_standards.py @@ -5,7 +5,6 @@ import os import pytest -from ..testing import xfail try: import pep8 @@ -249,8 +248,8 @@ def test_pep8_conformance_examples(): fp, tail = os.path.split(fp) if mpldir is None: - xfail("can not find the examples, set env MPL_REPO_DIR to point " - "to the top-level path of the source tree") + pytest.xfail("can not find the examples, set env MPL_REPO_DIR to " + "point to the top-level path of the source tree") exdir = os.path.join(mpldir, 'examples') blacklist = () diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py index ca341e74cf42..896659d875a3 100644 --- a/lib/matplotlib/tests/test_colors.py +++ b/lib/matplotlib/tests/test_colors.py @@ -18,8 +18,7 @@ import matplotlib.colorbar as mcolorbar import matplotlib.cbook as cbook import matplotlib.pyplot as plt -from matplotlib.testing.decorators import (image_comparison, - cleanup, knownfailureif) +from matplotlib.testing.decorators import image_comparison, cleanup def test_resample(): @@ -448,8 +447,8 @@ def test_light_source_shading_default(): assert_array_almost_equal(rgb, expect, decimal=2) -@knownfailureif((V(np.__version__) <= V('1.9.0') - and V(np.__version__) >= V('1.7.0'))) +@pytest.mark.xfail(V('1.7.0') <= V(np.__version__) <= V('1.9.0'), + reason='NumPy version is not buggy') # Numpy 1.9.1 fixed a bug in masked arrays which resulted in # additional elements being masked when calculating the gradient thus # the output is different with earlier numpy versions. diff --git a/lib/matplotlib/tests/test_font_manager.py b/lib/matplotlib/tests/test_font_manager.py index 2d8e67581518..0ce4a5ee077a 100644 --- a/lib/matplotlib/tests/test_font_manager.py +++ b/lib/matplotlib/tests/test_font_manager.py @@ -8,11 +8,12 @@ import tempfile import warnings +import pytest + from matplotlib.font_manager import ( findfont, FontProperties, fontManager, json_dump, json_load, get_font, get_fontconfig_fonts, is_opentype_cff_font, fontManager as fm) from matplotlib import rc_context -from matplotlib.testing.decorators import skipif def test_font_priority(): @@ -64,6 +65,6 @@ def test_otf(): assert res == is_opentype_cff_font(f) -@skipif(sys.platform == 'win32', reason='no fontconfig on Windows') +@pytest.mark.skipif(sys.platform == 'win32', reason='no fontconfig on Windows') def test_get_fontconfig_fonts(): assert len(get_fontconfig_fonts()) > 1 diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py index dad4f9ba3408..a35b173f764f 100644 --- a/lib/matplotlib/tests/test_image.py +++ b/lib/matplotlib/tests/test_image.py @@ -9,8 +9,7 @@ import numpy as np from numpy.testing import assert_array_equal -from matplotlib.testing.decorators import (image_comparison, - knownfailureif, cleanup) +from matplotlib.testing.decorators import image_comparison, cleanup from matplotlib.image import (AxesImage, BboxImage, FigureImage, NonUniformImage, PcolorImage) from matplotlib.transforms import Bbox, Affine2D, TransformedBbox @@ -31,6 +30,7 @@ HAS_PIL = True except ImportError: HAS_PIL = False +needs_pillow = pytest.mark.xfail(not HAS_PIL, reason='Test requires Pillow') @image_comparison(baseline_images=['image_interps']) @@ -101,7 +101,7 @@ def test_image_python_io(): plt.imread(buffer) -@knownfailureif(not HAS_PIL) +@needs_pillow def test_imread_pil_uint16(): img = plt.imread(os.path.join(os.path.dirname(__file__), 'baseline_images', 'test_image', 'uint16.tif')) @@ -480,7 +480,7 @@ def test_nonuniformimage_setnorm(): im.set_norm(plt.Normalize()) -@knownfailureif(not HAS_PIL) +@needs_pillow @cleanup def test_jpeg_alpha(): plt.figure(figsize=(1, 1), dpi=300) diff --git a/lib/matplotlib/tests/test_mathtext.py b/lib/matplotlib/tests/test_mathtext.py index 4c3d8972a1c5..61ca55669635 100644 --- a/lib/matplotlib/tests/test_mathtext.py +++ b/lib/matplotlib/tests/test_mathtext.py @@ -10,7 +10,7 @@ import pytest import matplotlib -from matplotlib.testing.decorators import image_comparison, knownfailureif, cleanup +from matplotlib.testing.decorators import image_comparison, cleanup import matplotlib.pyplot as plt from matplotlib import mathtext diff --git a/lib/matplotlib/tests/test_mlab.py b/lib/matplotlib/tests/test_mlab.py index 0e438a506d6d..5b42e0823d01 100644 --- a/lib/matplotlib/tests/test_mlab.py +++ b/lib/matplotlib/tests/test_mlab.py @@ -14,7 +14,7 @@ import matplotlib.mlab as mlab import matplotlib.cbook as cbook -from matplotlib.testing.decorators import knownfailureif, CleanupTestCase +from matplotlib.testing.decorators import CleanupTestCase try: @@ -2837,7 +2837,7 @@ def get_z(x, y): np.ma.getmask(correct_zi_masked)) -@knownfailureif(not HAS_NATGRID) +@pytest.mark.xfail(not HAS_NATGRID, reason='natgrid not installed') def test_griddata_nn(): # z is a linear function of x and y. def get_z(x, y): diff --git a/lib/matplotlib/tests/test_patheffects.py b/lib/matplotlib/tests/test_patheffects.py index 4417347c854a..73182a9fb989 100644 --- a/lib/matplotlib/tests/test_patheffects.py +++ b/lib/matplotlib/tests/test_patheffects.py @@ -2,9 +2,9 @@ unicode_literals) import numpy as np +import pytest -from matplotlib.testing.decorators import (image_comparison, cleanup, - knownfailureif) +from matplotlib.testing.decorators import image_comparison, cleanup import matplotlib.pyplot as plt import matplotlib.patheffects as path_effects @@ -76,7 +76,7 @@ def test_patheffect3(): @cleanup -@knownfailureif(True) +@pytest.mark.xfail def test_PathEffect_points_to_pixels(): fig = plt.figure(dpi=150) p1, = plt.plot(range(10)) diff --git a/lib/matplotlib/tests/test_rcparams.py b/lib/matplotlib/tests/test_rcparams.py index aff954950e40..83eda78cf5c4 100644 --- a/lib/matplotlib/tests/test_rcparams.py +++ b/lib/matplotlib/tests/test_rcparams.py @@ -18,7 +18,7 @@ import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.tests import assert_str_equal -from matplotlib.testing.decorators import cleanup, knownfailureif +from matplotlib.testing.decorators import cleanup import matplotlib.colors as mcolors from itertools import chain import numpy as np diff --git a/lib/matplotlib/tests/test_tightlayout.py b/lib/matplotlib/tests/test_tightlayout.py index 6c8ce70e162b..d0a9cf5980ba 100644 --- a/lib/matplotlib/tests/test_tightlayout.py +++ b/lib/matplotlib/tests/test_tightlayout.py @@ -6,7 +6,7 @@ import numpy as np -from matplotlib.testing.decorators import image_comparison, knownfailureif +from matplotlib.testing.decorators import image_comparison import matplotlib.pyplot as plt from matplotlib.offsetbox import AnchoredOffsetbox, DrawingArea from matplotlib.patches import Rectangle