Skip to content

Commit 7d3f66c

Browse files
dbrattliclaude
andauthored
test: skip tkinter scheduler tests on PyPy (all platforms) (#760)
* test: skip tkinter scheduler tests on PyPy (all platforms) The module creates `tkinter.Tk()` at import time. During PyPy interpreter shutdown, `_tkinter/app.py`'s `__del__` calls `threading.notify_all`, which can abort the process with `Fatal Python error: Aborted`. When this happens inside an xdist worker it takes the worker down and fails whichever unrelated test happens to be running (e.g. test_case_three), showing up as a non-deterministic CI failure. The skip guard previously only covered macOS+PyPy; extend it to all PyPy platforms so the Linux PyPy job stops flaking. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * style: apply ruff-format to tkinter test skip Collapse the `pytest.skip(...)` call onto a single line per ruff-format. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent dbf4da0 commit 7d3f66c

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

changes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Unreleased
44

5+
- CI: Skip `tests/test_scheduler/test_mainloop/test_tkinterscheduler.py` on
6+
PyPy (all platforms). The module creates a Tk root at import time; PyPy's
7+
`_tkinter` finalizer calls `threading.notify_all` during interpreter
8+
shutdown and aborts the xdist worker, failing whichever unrelated test
9+
was running. Previously guarded only on macOS+PyPy.
510
- Fix: `reactivex.timer(duetime, period)` now correctly resets the initial
611
delay on each resubscription (e.g. via `repeat()`). Previously `nonlocal
712
duetime` in the subscribe closure mutated the shared outer variable so

tests/test_scheduler/test_mainloop/test_tkinterscheduler.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import platform
32
import sys
43
import unittest
54
from datetime import timedelta
@@ -10,13 +9,13 @@
109
from reactivex.internal.basic import default_now
1110
from reactivex.scheduler.mainloop import TkinterScheduler
1211

13-
# Skip entire module on PyPy + macOS due to threading issues with Tkinter
14-
# Error: "Tcl_AsyncDelete: async handler deleted by the wrong thread"
15-
# This occurs when pytest-xdist tries to parallelize tests that use Tkinter
16-
if platform.system() == "Darwin" and hasattr(sys, "pypy_version_info"):
17-
pytest.skip(
18-
"Tkinter tests are incompatible with PyPy on macOS", allow_module_level=True
19-
)
12+
# Skip entire module on PyPy due to Tkinter interpreter/finalizer issues.
13+
# On macOS: "Tcl_AsyncDelete: async handler deleted by the wrong thread".
14+
# On Linux: PyPy's _tkinter app __del__ calls threading.notify_all during
15+
# interpreter shutdown, which aborts the xdist worker and fails whichever
16+
# test it was running.
17+
if hasattr(sys, "pypy_version_info"):
18+
pytest.skip("Tkinter tests are incompatible with PyPy", allow_module_level=True)
2019

2120
tkinter = pytest.importorskip("tkinter")
2221

0 commit comments

Comments
 (0)