Skip to content

Rename test markers #23248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/matplotlib/testing/_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
5 changes: 3 additions & 2 deletions lib/matplotlib/tests/test_backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
37 changes: 19 additions & 18 deletions lib/matplotlib/tests/test_backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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():
Expand All @@ -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',
Expand All @@ -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():
Expand Down Expand Up @@ -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():
Expand All @@ -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():
Expand All @@ -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():
Expand All @@ -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 = {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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()
Expand All @@ -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"
Expand Down