Skip to content

Commit c02db05

Browse files
authored
Fix intermittent test failures on Windows CI due to Tcl/Tk initialization race condition (#558)
Plot tests on Windows CI were failing intermittently with `_tkinter.TclError: Can't find a usable init.tcl`, causing flaky test runs that would pass on retry. This was a race condition where uv's Python extraction on Windows didn't complete before matplotlib tried to initialize Tkinter. This fix sets `MPLBACKEND=Agg` in the test workflow, which tells matplotlib to use the non-interactive Agg backend instead of Tkinter. This is standard practice for CI environments and eliminates the Tcl dependency entirely. Plot functionality remains fully tested—the Agg backend generates static images instead of interactive windows.
2 parents 48d3f9e + 4089b15 commit c02db05

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ jobs:
3131
if: startsWith(matrix.os, 'ubuntu')
3232
run: sudo apt-get install -y libsndfile1
3333
- name: Run tests
34+
env:
35+
MPLBACKEND: Agg
3436
run: uv run --with ${{ matrix.numpy }} --extra dev pytest
3537

3638
test-deb11-i386:

0 commit comments

Comments
 (0)