Skip to content

Commit f4c9fd7

Browse files
committed
Fix flaky CI tests caused by matplotlib font cache warning
The matplotlib font cache warning message was appearing in CI environments on first run, causing test_gated_solution_build and test_gated_solution_doctree to fail when comparing output with regression fixtures. Added regex patterns to FileRegression.changes to strip out the matplotlib font cache stderr output in both HTML and XML doctree formats.
1 parent b96a0d2 commit f4c9fd7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ class FileRegression:
9999
(r"ipykernel_\d+", "ipykernel_XXXXX"),
100100
# Normalize matplotlib image hashes (platform/version dependent)
101101
(r"[a-f0-9]{64}\.png", "IMAGEHASH.png"),
102+
# Strip matplotlib font cache warning (appears in CI on first run)
103+
(
104+
r'<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Matplotlib is building the font cache; this may take a moment\.\n</pre></div>\n</div>\n',
105+
"",
106+
),
107+
(
108+
r'<literal_block classes="output stderr" language="myst-ansi" xml:space="preserve">\s*Matplotlib is building the font cache; this may take a moment\.\n\s*',
109+
"",
110+
),
102111
)
103112

104113
def __init__(self, file_regression):

0 commit comments

Comments
 (0)