From 6a69b3e5e1846b169cacf65d8a851423af9decf5 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Sat, 11 Jun 2022 15:26:38 +0200 Subject: [PATCH] Rename test markers --- lib/matplotlib/testing/_markers.py | 10 +++--- lib/matplotlib/tests/test_backend_bases.py | 5 +-- lib/matplotlib/tests/test_backend_pgf.py | 37 +++++++++++----------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/lib/matplotlib/testing/_markers.py b/lib/matplotlib/testing/_markers.py index fc35df665696..df3ebb08cf8c 100644 --- a/lib/matplotlib/testing/_markers.py +++ b/lib/matplotlib/testing/_markers.py @@ -34,15 +34,15 @@ def _checkdep_usetex(): needs_ghostscript = pytest.mark.skipif( "eps" not in matplotlib.testing.compare.converter, reason="This test needs a ghostscript installation") -needs_lualatex = pytest.mark.skipif( +needs_pgf_lualatex = pytest.mark.skipif( not matplotlib.testing._check_for_pgf('lualatex'), reason='lualatex + pgf is required') -needs_pdflatex = pytest.mark.skipif( +needs_pgf_pdflatex = pytest.mark.skipif( not matplotlib.testing._check_for_pgf('pdflatex'), reason='pdflatex + pgf is required') +needs_pgf_xelatex = pytest.mark.skipif( + not matplotlib.testing._check_for_pgf('xelatex'), + reason='xelatex + pgf is required') needs_usetex = pytest.mark.skipif( not _checkdep_usetex(), reason="This test needs a TeX installation") -needs_xelatex = pytest.mark.skipif( - not matplotlib.testing._check_for_pgf('xelatex'), - reason='xelatex + pgf is required') diff --git a/lib/matplotlib/tests/test_backend_bases.py b/lib/matplotlib/tests/test_backend_bases.py index b7e32a19dd18..b86b89e3d5f6 100644 --- a/lib/matplotlib/tests/test_backend_bases.py +++ b/lib/matplotlib/tests/test_backend_bases.py @@ -5,7 +5,7 @@ FigureCanvasBase, LocationEvent, MouseButton, MouseEvent, NavigationToolbar2, RendererBase) from matplotlib.figure import Figure -from matplotlib.testing._markers import needs_xelatex +from matplotlib.testing._markers import needs_pgf_xelatex import matplotlib.pyplot as plt import numpy as np @@ -251,7 +251,8 @@ def test_toolbar_zoompan(): @pytest.mark.parametrize( - "backend", ['svg', 'ps', 'pdf', pytest.param('pgf', marks=needs_xelatex)] + "backend", ['svg', 'ps', 'pdf', + pytest.param('pgf', marks=needs_pgf_xelatex)] ) def test_draw(backend): from matplotlib.figure import Figure diff --git a/lib/matplotlib/tests/test_backend_pgf.py b/lib/matplotlib/tests/test_backend_pgf.py index 4c1d1763d7a9..b7928d9d2748 100644 --- a/lib/matplotlib/tests/test_backend_pgf.py +++ b/lib/matplotlib/tests/test_backend_pgf.py @@ -15,7 +15,8 @@ from matplotlib.testing.decorators import ( _image_directories, check_figures_equal, image_comparison) from matplotlib.testing._markers import ( - needs_ghostscript, needs_lualatex, needs_pdflatex, needs_xelatex) + needs_ghostscript, needs_pgf_lualatex, needs_pgf_pdflatex, + needs_pgf_xelatex) baseline_dir, result_dir = _image_directories(lambda: 'dummy func') @@ -70,7 +71,7 @@ def test_tex_escape(plain_text, escaped_text): # test compiling a figure to pdf with xelatex -@needs_xelatex +@needs_pgf_xelatex @pytest.mark.backend('pgf') @image_comparison(['pgf_xelatex.pdf'], style='default') def test_xelatex(): @@ -88,7 +89,7 @@ def test_xelatex(): # test compiling a figure to pdf with pdflatex -@needs_pdflatex +@needs_pgf_pdflatex @pytest.mark.skipif(not _has_tex_package('ucs'), reason='needs ucs.sty') @pytest.mark.backend('pgf') @image_comparison(['pgf_pdflatex.pdf'], style='default', @@ -108,8 +109,8 @@ def test_pdflatex(): # test updating the rc parameters for each figure -@needs_xelatex -@needs_pdflatex +@needs_pgf_xelatex +@needs_pgf_pdflatex @mpl.style.context('default') @pytest.mark.backend('pgf') def test_rcupdate(): @@ -140,7 +141,7 @@ def test_rcupdate(): # test backend-side clipping, since large numbers are not supported by TeX -@needs_xelatex +@needs_pgf_xelatex @mpl.style.context('default') @pytest.mark.backend('pgf') def test_pathclip(): @@ -160,7 +161,7 @@ def test_pathclip(): # test mixed mode rendering -@needs_xelatex +@needs_pgf_xelatex @pytest.mark.backend('pgf') @image_comparison(['pgf_mixedmode.pdf'], style='default') def test_mixedmode(): @@ -170,7 +171,7 @@ def test_mixedmode(): # test bbox_inches clipping -@needs_xelatex +@needs_pgf_xelatex @mpl.style.context('default') @pytest.mark.backend('pgf') def test_bbox_inches(): @@ -187,9 +188,9 @@ def test_bbox_inches(): @mpl.style.context('default') @pytest.mark.backend('pgf') @pytest.mark.parametrize('system', [ - pytest.param('lualatex', marks=[needs_lualatex]), - pytest.param('pdflatex', marks=[needs_pdflatex]), - pytest.param('xelatex', marks=[needs_xelatex]), + pytest.param('lualatex', marks=[needs_pgf_lualatex]), + pytest.param('pdflatex', marks=[needs_pgf_pdflatex]), + pytest.param('xelatex', marks=[needs_pgf_xelatex]), ]) def test_pdf_pages(system): rc_pdflatex = { @@ -229,9 +230,9 @@ def test_pdf_pages(system): @mpl.style.context('default') @pytest.mark.backend('pgf') @pytest.mark.parametrize('system', [ - pytest.param('lualatex', marks=[needs_lualatex]), - pytest.param('pdflatex', marks=[needs_pdflatex]), - pytest.param('xelatex', marks=[needs_xelatex]), + pytest.param('lualatex', marks=[needs_pgf_lualatex]), + pytest.param('pdflatex', marks=[needs_pgf_pdflatex]), + pytest.param('xelatex', marks=[needs_pgf_xelatex]), ]) def test_pdf_pages_metadata_check(monkeypatch, system): # Basically the same as test_pdf_pages, but we keep it separate to leave @@ -283,7 +284,7 @@ def test_pdf_pages_metadata_check(monkeypatch, system): } -@needs_xelatex +@needs_pgf_xelatex def test_tex_restart_after_error(): fig = plt.figure() fig.suptitle(r"\oops") @@ -295,14 +296,14 @@ def test_tex_restart_after_error(): fig.savefig(BytesIO(), format="pgf") -@needs_xelatex +@needs_pgf_xelatex def test_bbox_inches_tight(): fig, ax = plt.subplots() ax.imshow([[0, 1], [2, 3]]) fig.savefig(BytesIO(), format="pdf", backend="pgf", bbox_inches="tight") -@needs_xelatex +@needs_pgf_xelatex @needs_ghostscript def test_png_transparency(): # Actually, also just testing that png works. buf = BytesIO() @@ -312,7 +313,7 @@ def test_png_transparency(): # Actually, also just testing that png works. assert (t[..., 3] == 0).all() # fully transparent. -@needs_xelatex +@needs_pgf_xelatex def test_unknown_font(caplog): with caplog.at_level("WARNING"): mpl.rcParams["font.family"] = "this-font-does-not-exist"