_________________________________________________________________________________________ test_pdf_pages_metadata_check[lualatex] _________________________________________________________________________________________
[gw2] linux -- Python 3.12.7 /home/codespace/micromamba/envs/mpl-dev/bin/python3.12
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7eedae2ff110>, system = 'lualatex'
@mpl.style.context('default')
@pytest.mark.backend('pgf')
@pytest.mark.parametrize('system', [
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
# pikepdf as an optional dependency.
pikepdf = pytest.importorskip('pikepdf')
monkeypatch.setenv('SOURCE_DATE_EPOCH', '0')
mpl.rcParams.update({'pgf.texsystem': system})
fig, ax = plt.subplots()
ax.plot(range(5))
md = {
'Author': 'me',
'Title': 'Multipage PDF with pgf',
'Subject': 'Test page',
'Keywords': 'test,pdf,multipage',
'ModDate': datetime.datetime(
1968, 8, 1, tzinfo=datetime.timezone(datetime.timedelta(0))),
'Trapped': 'True'
}
path = os.path.join(result_dir, f'pdfpages_meta_check_{system}.pdf')
with PdfPages(path, metadata=md) as pdf:
> pdf.savefig(fig)
lib/matplotlib/tests/test_backend_pgf.py:261:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lib/matplotlib/backends/backend_pgf.py:1005: in savefig
figure.savefig(self._file, format="pgf", backend="pgf", **kwargs)
lib/matplotlib/figure.py:3485: in savefig
self.canvas.print_figure(fname, **kwargs)
lib/matplotlib/backend_bases.py:2184: in print_figure
result = print_method(
lib/matplotlib/backend_bases.py:2040: in <lambda>
print_method = functools.wraps(meth)(lambda *args, **kwargs: meth(
lib/matplotlib/backends/backend_pgf.py:821: in print_pgf
self._print_pgf_to_fh(file, **kwargs)
lib/matplotlib/backends/backend_pgf.py:806: in _print_pgf_to_fh
self.figure.draw(renderer)
lib/matplotlib/artist.py:94: in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
lib/matplotlib/artist.py:71: in draw_wrapper
return draw(artist, renderer)
lib/matplotlib/figure.py:3252: in draw
mimage._draw_list_compositing_images(
lib/matplotlib/image.py:134: in _draw_list_compositing_images
a.draw(renderer)
lib/matplotlib/artist.py:71: in draw_wrapper
return draw(artist, renderer)
lib/matplotlib/axes/_base.py:3182: in draw
mimage._draw_list_compositing_images(
lib/matplotlib/image.py:134: in _draw_list_compositing_images
a.draw(renderer)
lib/matplotlib/artist.py:71: in draw_wrapper
return draw(artist, renderer)
lib/matplotlib/axis.py:1411: in draw
tlb1, tlb2 = self._get_ticklabel_bboxes(ticks_to_draw, renderer)
lib/matplotlib/axis.py:1338: in _get_ticklabel_bboxes
return ([tick.label1.get_window_extent(renderer)
lib/matplotlib/text.py:969: in get_window_extent
bbox, info, descent = self._get_layout(self._renderer)
lib/matplotlib/text.py:373: in _get_layout
_, lp_h, lp_d = _get_text_metrics_with_cache(
lib/matplotlib/text.py:69: in _get_text_metrics_with_cache
return _get_text_metrics_with_cache_impl(
lib/matplotlib/text.py:77: in _get_text_metrics_with_cache_impl
return renderer_ref().get_text_width_height_descent(text, fontprop, ismath)
lib/matplotlib/backends/backend_pgf.py:727: in get_text_width_height_descent
w, h, d = (LatexManager._get_cached_or_new()
lib/matplotlib/backends/backend_pgf.py:226: in _get_cached_or_new
return cls._get_cached_or_new_impl(cls._build_latex_header())
lib/matplotlib/backends/backend_pgf.py:231: in _get_cached_or_new_impl
return cls()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <matplotlib.backends.backend_pgf.LatexManager object at 0x7eedade20e30>
def __init__(self):
# create a tmp directory for running latex, register it for deletion
self._tmpdir = TemporaryDirectory()
self.tmpdir = self._tmpdir.name
self._finalize_tmpdir = weakref.finalize(self, self._tmpdir.cleanup)
# test the LaTeX setup to ensure a clean startup of the subprocess
self._setup_latex_process(expect_reply=False)
stdout, stderr = self.latex.communicate("\n\\makeatletter\\@@end\n")
if self.latex.returncode != 0:
> raise LatexError(
f"LaTeX errored (probably missing font or error in preamble) "
f"while processing the following input:\n"
f"{self._build_latex_header()}",
stdout)
E matplotlib.backends.backend_pgf.LatexError: LaTeX errored (probably missing font or error in preamble) while processing the following input:
E \documentclass{article}
E % !TeX program = lualatex
E \usepackage{graphicx}
E \def\mathdefault#1{#1}
E \everymath=\expandafter{\the\everymath\displaystyle}
E \IfFileExists{scrextend.sty}{
E \usepackage[fontsize=10.000000pt]{scrextend}
E }{
E \renewcommand{\normalsize}{\fontsize{10.000000}{12.000000}\selectfont}
E \normalsize
E }
E
E \ifdefined\pdftexversion\else % non-pdftex case.
E \usepackage{fontspec}
E \setmainfont{DejaVuSerif.ttf}[Path=\detokenize{/workspaces/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/}]
E \setsansfont{DejaVuSans.ttf}[Path=\detokenize{/workspaces/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/}]
E \setmonofont{DejaVuSansMono.ttf}[Path=\detokenize{/workspaces/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/}]
E \fi
E \makeatletter\@ifpackageloaded{underscore}{}{\usepackage[strings]{underscore}}\makeatother
E \begin{document}
E \typeout{pgf_backend_query_start}
E This is LuaTeX, Version 1.10.0 (TeX Live 2019/Debian)
E restricted system commands enabled.
E **LaTeX2e <2020-02-02> patch level 2
E
E [\directlua]:1: module 'luaotfload-main' not found:
E no field package.preload['luaotfload-main']
E [kpse lua searcher] file not found: 'luaotfload-main'
E [kpse C searcher] file not found: 'luaotfload-main'
E Error in luaotfload: reverting to OT1L3 programming layer <2020-02-14>
E *
E *(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
E Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
E (/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
E (/usr/share/texmf/tex/latex/lm/ot1lmr.fd)))
E *(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
E (/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
E (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
E (/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
E (/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
E (/usr/share/texlive/texmf-dist/tex/latex/graphics-def/luatex.def)))
E *
E *
E *
E *
E *
E *
E *
E *(/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrextend.sty
E (/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrkbase.sty
E (/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrbase.sty
E (/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrlfile.sty))))
E (/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrsize10pt.clo)
E (Please type a command or say `\end')
E *
E *
E *(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty
E (/usr/share/texlive/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
E (/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty
E (/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def)))
E (/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
E (/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
E ! Font \TU/lmr/m/n/10=[lmroman10-regular]:+tlig; at 10pt not loadable: metric d
E ata not found or bad.
E <to be read again>
E relax
E l.112 ...lt\familydefault\seriesdefault\shapedefault
E
E 347 words of node memory still in use:
E 2 hlist, 1 rule, 1 dir, 48 glue_spec, 3 if_stack, 1 write nodes
E avail lists: 2:9,3:1,4:1,5:2,7:2,9:3
E ! ==> Fatal error occurred, no output PDF file produced!
E Transcript written on texput.log.
lib/matplotlib/backends/backend_pgf.py:267: LatexError
_________________________________________________________________________________________ test_minus_signs_with_tex[lualatex-pdf] _________________________________________________________________________________________
[gw2] linux -- Python 3.12.7 /home/codespace/micromamba/envs/mpl-dev/bin/python3.12
ext = 'pdf', request = <FixtureRequest for <Function test_minus_signs_with_tex[lualatex-pdf]>>, args = (), kwargs = {'texsystem': 'lualatex'}, file_name = 'test_minus_signs_with_tex[lualatex-pdf]'
fig_test = <Figure size 640x480 with 0 Axes>, fig_ref = <Figure size 640x480 with 0 Axes>, figs = []
test_image_path = PosixPath('/workspaces/matplotlib/result_images/test_backend_pgf/test_minus_signs_with_tex[lualatex-pdf].pdf')
ref_image_path = PosixPath('/workspaces/matplotlib/result_images/test_backend_pgf/test_minus_signs_with_tex[lualatex-pdf]-expected.pdf')
@pytest.mark.parametrize("ext", extensions)
def wrapper(*args, ext, request, **kwargs):
if 'ext' in old_sig.parameters:
kwargs['ext'] = ext
if 'request' in old_sig.parameters:
kwargs['request'] = request
file_name = "".join(c for c in request.node.name
if c in ALLOWED_CHARS)
try:
fig_test = plt.figure("test")
fig_ref = plt.figure("reference")
with _collect_new_figures() as figs:
func(*args, fig_test=fig_test, fig_ref=fig_ref, **kwargs)
if figs:
raise RuntimeError('Number of open figures changed during '
'test. Make sure you are plotting to '
'fig_test or fig_ref, or if this is '
'deliberate explicitly close the '
'new figure(s) inside the test.')
test_image_path = result_dir / (file_name + "." + ext)
ref_image_path = result_dir / (file_name + "-expected." + ext)
> fig_test.savefig(test_image_path)
lib/matplotlib/testing/decorators.py:420:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lib/matplotlib/figure.py:3485: in savefig
self.canvas.print_figure(fname, **kwargs)
lib/matplotlib/backend_bases.py:2184: in print_figure
result = print_method(
lib/matplotlib/backend_bases.py:2040: in <lambda>
print_method = functools.wraps(meth)(lambda *args, **kwargs: meth(
lib/matplotlib/backends/backend_pgf.py:834: in print_pdf
self.print_pgf(tmppath / "figure.pgf", **kwargs)
lib/matplotlib/backends/backend_pgf.py:821: in print_pgf
self._print_pgf_to_fh(file, **kwargs)
lib/matplotlib/backends/backend_pgf.py:806: in _print_pgf_to_fh
self.figure.draw(renderer)
lib/matplotlib/artist.py:94: in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
lib/matplotlib/artist.py:71: in draw_wrapper
return draw(artist, renderer)
lib/matplotlib/figure.py:3252: in draw
mimage._draw_list_compositing_images(
lib/matplotlib/image.py:134: in _draw_list_compositing_images
a.draw(renderer)
lib/matplotlib/artist.py:71: in draw_wrapper
return draw(artist, renderer)
lib/matplotlib/text.py:752: in draw
bbox, info, descent = self._get_layout(renderer)
lib/matplotlib/text.py:373: in _get_layout
_, lp_h, lp_d = _get_text_metrics_with_cache(
lib/matplotlib/text.py:69: in _get_text_metrics_with_cache
return _get_text_metrics_with_cache_impl(
lib/matplotlib/text.py:77: in _get_text_metrics_with_cache_impl
return renderer_ref().get_text_width_height_descent(text, fontprop, ismath)
lib/matplotlib/backends/backend_pgf.py:727: in get_text_width_height_descent
w, h, d = (LatexManager._get_cached_or_new()
lib/matplotlib/backends/backend_pgf.py:226: in _get_cached_or_new
return cls._get_cached_or_new_impl(cls._build_latex_header())
lib/matplotlib/backends/backend_pgf.py:231: in _get_cached_or_new_impl
return cls()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <matplotlib.backends.backend_pgf.LatexManager object at 0x7eedae6f3b30>
def __init__(self):
# create a tmp directory for running latex, register it for deletion
self._tmpdir = TemporaryDirectory()
self.tmpdir = self._tmpdir.name
self._finalize_tmpdir = weakref.finalize(self, self._tmpdir.cleanup)
# test the LaTeX setup to ensure a clean startup of the subprocess
self._setup_latex_process(expect_reply=False)
stdout, stderr = self.latex.communicate("\n\\makeatletter\\@@end\n")
if self.latex.returncode != 0:
> raise LatexError(
f"LaTeX errored (probably missing font or error in preamble) "
f"while processing the following input:\n"
f"{self._build_latex_header()}",
stdout)
E matplotlib.backends.backend_pgf.LatexError: LaTeX errored (probably missing font or error in preamble) while processing the following input:
E \documentclass{article}
E % !TeX program = lualatex
E \usepackage{graphicx}
E \def\mathdefault#1{#1}
E \everymath=\expandafter{\the\everymath\displaystyle}
E \IfFileExists{scrextend.sty}{
E \usepackage[fontsize=12.000000pt]{scrextend}
E }{
E \renewcommand{\normalsize}{\fontsize{12.000000}{14.400000}\selectfont}
E \normalsize
E }
E
E \ifdefined\pdftexversion\else % non-pdftex case.
E \usepackage{fontspec}
E \setmainfont{DejaVuSerif.ttf}[Path=\detokenize{/workspaces/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/}]
E \setsansfont{DejaVuSans.ttf}[Path=\detokenize{/workspaces/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/}]
E \setmonofont{DejaVuSansMono.ttf}[Path=\detokenize{/workspaces/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/}]
E \fi
E \makeatletter\@ifpackageloaded{underscore}{}{\usepackage[strings]{underscore}}\makeatother
E \begin{document}
E \typeout{pgf_backend_query_start}
E This is LuaTeX, Version 1.10.0 (TeX Live 2019/Debian)
E restricted system commands enabled.
E **LaTeX2e <2020-02-02> patch level 2
E
E [\directlua]:1: module 'luaotfload-main' not found:
E no field package.preload['luaotfload-main']
E [kpse lua searcher] file not found: 'luaotfload-main'
E [kpse C searcher] file not found: 'luaotfload-main'
E Error in luaotfload: reverting to OT1L3 programming layer <2020-02-14>
E *
E *(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
E Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
E (/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
E (/usr/share/texmf/tex/latex/lm/ot1lmr.fd)))
E *(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
E (/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
E (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
E (/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
E (/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
E (/usr/share/texlive/texmf-dist/tex/latex/graphics-def/luatex.def)))
E *
E *
E *
E *
E *
E *
E *
E *(/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrextend.sty
E (/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrkbase.sty
E (/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrbase.sty
E (/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrlfile.sty))))
E (/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrsize12pt.clo)
E (Please type a command or say `\end')
E *
E *
E *(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty
E (/usr/share/texlive/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
E (/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty
E (/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def)))
E (/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
E (/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
E ! Font \TU/lmr/m/n/12=[lmroman12-regular]:+tlig; at 12pt not loadable: metric d
E ata not found or bad.
E <to be read again>
E relax
E l.112 ...lt\familydefault\seriesdefault\shapedefault
E
E 347 words of node memory still in use:
E 2 hlist, 1 rule, 1 dir, 48 glue_spec, 3 if_stack, 1 write nodes
E avail lists: 2:9,3:2,4:1,5:2,7:2,9:3
E ! ==> Fatal error occurred, no output PDF file produced!
E Transcript written on texput.log.
lib/matplotlib/backends/backend_pgf.py:267: LatexError
________________________________________________________________________________________________ test_openin_any_paranoid _________________________________________________________________________________________________
[gw0] linux -- Python 3.12.7 /home/codespace/micromamba/envs/mpl-dev/bin/python3.12
@needs_usetex
def test_openin_any_paranoid():
completed = subprocess_run_for_testing(
[sys.executable, "-c",
'import matplotlib.pyplot as plt;'
'plt.rcParams.update({"text.usetex": True});'
'plt.title("paranoid");'
'plt.show(block=False);'],
env={**os.environ, 'openin_any': 'p'}, check=True, capture_output=True)
> assert completed.stderr == ""
E assert "QStandardPat...-codespace'\n" == ''
E
E + QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-codespace'
lib/matplotlib/tests/test_texmanager.py:75: AssertionError
Summary
I just tried running the tests against a clean branch in codespaces and got these failures
Failure Details
Proposed fix
The first two failures seem to indicate something is missing. Is this something that can be added to the codespace setup?
cc @melissawm as I think you are the codespaces expert.