Commit 19a54d6
test: prime pycares shutdown thread at session scope; revert oauth band-aid
The CI Python 3.12 leg backtracks to homeassistant 2025.1.4 / pytest-HA-CC
0.13.205, whose lingering-thread check has no whitelist for the
_run_safe_shutdown_loop daemon that aiohttp's aiodns resolver (pycares) spawns
the first time a test builds a clientsession. Whichever session-creating test
runs first gets blamed -- so the previous per-test hermetic fix in
test_oauth.py just moved the failure to test_oauth_wiring.py.
Root fix: a session-scoped autouse fixture in conftest.py starts pycares'
shared shutdown-manager thread once, before verify_cleanup snapshots
threads_before. The thread is then in every test's baseline and never counted
as leaked -- covering all current and future clientsession tests without
lowering fidelity. pycares' start() is idempotent and its loop only blocks on a
queue (no socket/DNS/event loop), so it is safe under pytest-socket. Validated
against the exact CI pycares version (5.0.1).
Revert the test_oauth.py boundary-mock band-aid now that the fixture makes the
original aioresponses test (which exercises the real envelope parse) safe again.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ff57549 commit 19a54d6
2 files changed
Lines changed: 29 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
38 | 63 | | |
39 | 64 | | |
40 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
12 | 11 | | |
13 | 12 | | |
14 | | - | |
15 | | - | |
16 | 13 | | |
17 | 14 | | |
18 | 15 | | |
| |||
46 | 43 | | |
47 | 44 | | |
48 | 45 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 46 | + | |
58 | 47 | | |
59 | 48 | | |
60 | 49 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 50 | + | |
| 51 | + | |
66 | 52 | | |
67 | 53 | | |
68 | 54 | | |
| |||
0 commit comments