Skip to content

Commit e2e3f3e

Browse files
Fix asyncio event-loop leak; expand CI to the full non-browser suite (#184)
* test(claude_session): remove orphaned fixtures test left by #174 #174 (aa815ee) intentionally deleted mcp/claude-session/fixtures/ (the MalformedWriteToolInput model + its fixture + manifest.json) but left tests/claude_session/test_fixtures.py asserting that now-missing directory -- silently red on main since. Remove the dead test, its dir-local conftest, and the now-empty test package. * fix(tests): upgrade pytest-asyncio 1.3.0 -> 1.4.0 (event-loop leak) 1.3.0's _temporary_event_loop_policy captured the current loop via asyncio.get_event_loop() to restore per async test; on Python 3.13 that fabricates an unclosed _UnixSelectorEventLoop + AF_UNIX socketpair, which filterwarnings=["error"] escalated into a non-deterministic PytestUnraisableExceptionWarning landing on a random victim test. 1.4.0 drops the loop capture/restore (upstream pytest-dev/pytest-asyncio#1164). Verified: the previously non-deterministic cc_lib+crb+hooks combo now passes 429/429 across repeated runs. * ci: run the full suite (minus browser-only selenium) on every PR The pytest-asyncio 1.4.0 loop-leak fix + orphan-test cleanup make the non-browser suite deterministic, so CI now guards all 830 of those tests instead of just tests/linters/. tests/selenium_browser needs a real browser the ubuntu runner lacks; it gets a dedicated browser job in a follow-up. * ci: install zsh for claude-remote-bash executor tests The crb executor runs commands in /bin/zsh (its configured shell); ubuntu runners don't ship zsh, so 12 test_executor.py tests failed with FileNotFoundError. Same shape as libsnappy: a real crb runtime dependency the runner must provide.
1 parent 1cda088 commit e2e3f3e

6 files changed

Lines changed: 18 additions & 107 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ jobs:
2222
with:
2323
python-version: '3.13'
2424
enable-cache: true
25-
- name: System libraries for native deps
26-
# python-snappy (selenium-browser -> dfindexeddb) builds from source on Linux; needs libsnappy headers.
27-
run: sudo apt-get update && sudo apt-get install -y libsnappy-dev
25+
- name: System dependencies
26+
# libsnappy-dev: python-snappy (selenium-browser -> dfindexeddb) builds from source on Linux.
27+
# zsh: claude-remote-bash runs commands in /bin/zsh, exercised by the executor tests.
28+
run: sudo apt-get update && sudo apt-get install -y libsnappy-dev zsh
2829
- name: Sync workspace
2930
run: uv sync --locked --all-packages --all-groups
3031
- name: Lint, format, type-check, custom linters (pre-commit)
3132
run: uv run pre-commit run --all-files --show-diff-on-failure
3233
- name: Tests
33-
# tests/linters/ only — the rest of tests/ has pre-existing cross-test pollution to fix first.
34-
run: uv run pytest tests/linters/
34+
# Full suite except selenium_browser, which needs a real browser the runner lacks
35+
# (covered by a dedicated browser job in a follow-up). Deterministic + green here.
36+
run: uv run pytest tests/ --ignore=tests/selenium_browser
3537

3638
merge-gatekeeper:
3739
name: merge-gatekeeper # required-status-check context — keep in sync with the branch ruleset

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,13 @@ dev = [
222222
"pydantic>=2.12.5", # Required for pydantic.mypy plugin
223223
"pymupdf-stubs>=1.26.1.post1",
224224
"pytest>=9.0.2",
225-
"pytest-asyncio>=1.3.0",
225+
# >=1.4.0: 1.3.0's _temporary_event_loop_policy captured the "current" loop via
226+
# asyncio.get_event_loop() to restore after each async test. On Python 3.13 that
227+
# call fabricates a _UnixSelectorEventLoop (+ AF_UNIX socketpair self-pipe) when
228+
# no loop is set, then never closes it — a ResourceWarning that filterwarnings=
229+
# ["error"] escalated onto a random victim test. 1.4.0 drops the loop capture/
230+
# restore, saving/restoring only the event-loop policy (upstream #1164).
231+
"pytest-asyncio>=1.4.0",
226232
"pytest-mypy-plugins>=3.3.0",
227233
"ruff>=0.14.10",
228234
"typer>=0.9.0",

tests/claude_session/__init__.py

Whitespace-only changes.

tests/claude_session/conftest.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/claude_session/test_fixtures.py

Lines changed: 0 additions & 92 deletions
This file was deleted.

uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)