Skip to content

Commit 5ef6b68

Browse files
committed
Fix tests
1 parent b6cc4d3 commit 5ef6b68

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

‎src/maxplotlib/tests/test_flame_chart.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Tests for flame chart functionality across all backends.
33
"""
44

5+
import shutil
6+
57
import numpy as np
68
import pytest
79

@@ -162,6 +164,13 @@ def test_flame_chart_tikzfigure_backend(sample_flame_data, tmp_path):
162164
canvas.set_ylabel("Stack Depth")
163165
canvas.set_title("Test Flame Chart")
164166

167+
# the TikZ code needs no LaTeX; compiling it to PDF needs pdflatex
168+
tikz_file = tmp_path / "test_flame_tikz.tikz"
169+
canvas.savefig(str(tikz_file), backend="tikzfigure")
170+
assert "\\begin{axis}" in tikz_file.read_text()
171+
172+
if shutil.which("pdflatex") is None:
173+
pytest.skip("pdflatex not installed")
165174
output_file = tmp_path / "test_flame_tikz.pdf"
166175
canvas.savefig(str(output_file), backend="tikzfigure")
167176

‎src/maxplotlib/tests/test_gantt_chart.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Tests for gantt chart functionality across all backends.
33
"""
44

5+
import shutil
6+
57
import numpy as np
68
import pytest
79

@@ -133,6 +135,13 @@ def test_gantt_chart_tikzfigure_backend(sample_gantt_data, tmp_path):
133135
canvas.set_xlabel("Time (days)")
134136
canvas.set_title("Project Timeline")
135137

138+
# the TikZ code needs no LaTeX; compiling it to PDF needs pdflatex
139+
tikz_file = tmp_path / "test_gantt_tikz.tikz"
140+
canvas.savefig(str(tikz_file), backend="tikzfigure")
141+
assert "\\begin{axis}" in tikz_file.read_text()
142+
143+
if shutil.which("pdflatex") is None:
144+
pytest.skip("pdflatex not installed")
136145
output_file = tmp_path / "test_gantt_tikz.pdf"
137146
canvas.savefig(str(output_file), backend="tikzfigure")
138147

0 commit comments

Comments
 (0)