Skip to content

Add dependency on ucs for pgf tests using [utf8x]{inputenc}. #18872

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
Nov 6, 2020
Merged
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: 7 additions & 3 deletions lib/matplotlib/tests/test_backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ def check_for(texsystem):
reason='lualatex + pgf is required')


def _has_sfmath():
def _has_tex_package(package):
return (shutil.which("kpsewhich")
and subprocess.run(["kpsewhich", "sfmath.sty"],
and subprocess.run(["kpsewhich", f"{package}.sty"],
stdout=subprocess.PIPE).returncode == 0)


Expand Down Expand Up @@ -113,6 +113,7 @@ def test_xelatex():

# test compiling a figure to pdf with pdflatex
@needs_pdflatex
@pytest.mark.skipif(not _has_tex_package('ucs'), reason='needs ucs.sty')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean to remove this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no? that test also needs ucs (and it's a single figure test so we can just use the decorator form)

@pytest.mark.backend('pgf')
@image_comparison(['pgf_pdflatex.pdf'], style='default')
def test_pdflatex():
Expand All @@ -132,7 +133,6 @@ def test_pdflatex():
# test updating the rc parameters for each figure
@needs_xelatex
@needs_pdflatex
@pytest.mark.skipif(not _has_sfmath(), reason='needs sfmath.sty')
@pytest.mark.style('default')
@pytest.mark.backend('pgf')
def test_rcupdate():
Expand All @@ -154,6 +154,10 @@ def test_rcupdate():
tol = [6, 0]
for i, rc_set in enumerate(rc_sets):
with mpl.rc_context(rc_set):
for substring, pkg in [('sfmath', 'sfmath'), ('utf8x', 'ucs')]:
if (substring in mpl.rcParams['pgf.preamble']
and not _has_tex_package(pkg)):
pytest.skip(f'needs {pkg}.sty')
create_figure()
compare_figure('pgf_rcupdate%d.pdf' % (i + 1), tol=tol[i])

Expand Down