Repository navigation
Description
The Run tests Python 3.14 job annotates every one of these calls. In https://github.com/zigpy/zha/actions/runs/32916926775/job/98022510877 that is 16,575 'asyncio.get_event_loop_policy' is deprecated and slated for removal in Python 3.16 plus 8,297 set_event_loop_policy — roughly 25k annotations in a single job, which buries the warnings that actually matter (the same log carries 82 asyncio.iscoroutinefunction ones and a handful of real quirks manufacturer_code warnings).
Source: pytest-asyncio, not zha
Every annotation that carries a file attributes to .venv/lib/python3.14/site-packages/pytest_asyncio/plugin.py (lines 772, 777, 794, 874, 942, …). zha's own package and test suite contain no get_event_loop_policy / set_event_loop_policy call at all, and the only other installed package that even mentions the API does so in a comment (freezegun).
We pin pytest-asyncio<1.0 (pyproject.toml:51, in the testing dependency group) → 0.26.0, which calls the policy API directly. pytest-asyncio 1.0.0 wrapped every one of those calls in warnings.catch_warnings() + simplefilter("ignore", DeprecationWarning) — the _get_event_loop_policy() / _set_event_loop_policy() helpers in plugin.py — and 1.4.0 (still the current release) keeps them. So getting past the pin silences all ~25k with no change on our side; no local warning filter is needed.
Open PRs in this repo — and a wrinkle in two of them
The pin moved house: requirements_test.txt was deleted in #773 (3adff2ca, 2026-05-28) when the test dependencies became the testing dependency group in pyproject.toml. Two of the three PRs below still edit that deleted file, so neither of them moves the pin that is actually in effect today.
- Bump pytest-asyncio from 0.26.0 to 1.4.0 #776 — dependabot: Bump pytest-asyncio from 0.26.0 to 1.4.0. Touches
pyproject.toml+uv.lock, i.e. the only one of the three aimed at where the pin now lives. - Bump pytest-asyncio to 1.4.0 #695 — Bump pytest-asyncio to 1.3.0 (draft). This is the one that fixes this issue. Brought up to date in 9f98151: dev merged, the version bump moved from
requirements_test.txttopyproject.toml, anduv.lockregenerated to 1.4.0. With it, the suite goes from 12522 warnings to 83, none of them from pytest-asyncio. The substantive half is itstests/conftest.pyadaptation to the removedevent_loopfixture, without which the bump cannot work. - Update pytest-asyncio requirement from <1.0 to <2.0 #476 — dependabot: Update pytest-asyncio requirement from
<1.0to<2.0(open since 2025-07-16). Editsrequirements_test.txtonly, so it is obsolete as it stands: dependabot is configured withpackage-ecosystem: uvand no longer manages that file at all. Probably closable. - Suppress expected warnings in tests #696 — Suppress expected warnings in tests (draft). Adjacent rather than a fix for this one: it filters warnings our own tests provoke, whereas these come from the plugin.
Home Assistant Core
- Create event loops with a factory instead of an event loop policy home-assistant/core#179871 — "Create event loops with a factory instead of an event loop policy" (balloob, merged 2026-08-25). This is the runtime half of the same 3.16 removal:
HassEventLoopPolicybecomes acreate_event_loop()factory, with the loop configuration moved intoconfigure_event_loop(), and the scripts passasyncio.run(..., loop_factory=...). zha installs no policy of its own, so there is nothing to port — but it is the reference for how the removal is being handled downstream, and worth watching if we ever want loop configuration of our own. - Update pytest-asyncio to 1.4.0 home-assistant/core#172886 — renovate: Update pytest-asyncio to 1.4.0 (merged 2026-06-03). HA Core is already past the pin, which is why their CI does not show this.
Related, same 3.16 removal wave
The same job logs 82 'asyncio.iscoroutinefunction' is deprecated … use inspect.iscoroutinefunction() instead warnings, and those are ours rather than the plugin's: zha/async_.py:136 is the only call site left. That half was tracked in #882 and is now fixed by #902 (merged), so it no longer contributes to the warning count. zigpy/bellows#741 already made the equivalent change there.
All PR states and file references re-verified against dev at c556ae2 on 2026-09-20.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Size
Area
Activity
TheJulianJES commentedon Sep 20, 2026
@zigpy-review-bot Check PRs. Anything left?
zigpy-review-bot commentedon Sep 20, 2026
Checked all four, plus a full local run on dev at 939b2b3.
The issue itself is fixed. #695 merged as 939b2b3 with
pytest-asyncio>=1.4.0inpyproject.tomland the lock resolved to 1.4.0. The Run tests Python 3.14 job on that commit (https://github.com/zigpy/zha/actions/runs/35487785314/job/106017250586) carries zeroget_event_loop_policy/set_event_loop_policyannotations, down from ~25k — and zeroasyncio.iscoroutinefunctionones, since #902 landed just before it. A full local run on dev: 1382 passed, 83 warnings, exactly the number this issue predicted.PR status
What #696 would still buy. The 83 warnings that remain on dev are exactly the two classes it filters:
Attribute '<name>' has is_manufacturer_specific without an explicit manufacturer_code, from zha-quirks 2.2.2 definitions (12 distinct attributes).tests/test_discover.py:824— "Unique IDs are unique only with platform prefix".I merged #696 onto current dev in a scratch worktree: it merges cleanly — one auto-merge in
tests/conftest.py, despite #695 having reworked that file — and the full suite then runs 1382 passed, 0 warnings. So it is still applicable as written and would take the 3.14 job's annotation list to empty.One call worth making before it lands: those 73 deprecations are genuine quirk bugs, not test noise — quirks declaring manufacturer-specific attributes without a
manufacturer_code, e.g.hooks_stateinzhaquirks/xiaomi/aqara/driver_curtain_e1.py,error_detected/last_feeding_sizeinzhaquirks/xiaomi/aqara/feeder_acn001.py,operation_presetinzhaquirks/tuya/ts0601_trv.py, plus Philips, Centralite, IKEA/Develco ones. zha cannot fix them from here, and filtering them intests/conftest.pyalso removes the only place they are currently surfaced — there is no open issue for them on zha-device-handlers. Worth filing one there before suppressing, if you want them tracked. The unique-ID UserWarning is zha's own and is deliberately warn-rather-raise, so filtering that one is uncontroversial.Nothing else open in zha touches this. Once #696 is decided either way, this issue can be closed — closing is outside what I do on my own.
Verification detail
pytest tests/ -q: 1382 passed, 83 warnings (73 DeprecationWarning + 10 UserWarning; zero from pytest_asyncio).git merge pr-696-check— clean):pytest tests/ -q→ 1382 passed, no warnings summary at all.grep -c event_loop_policy→ 0;grep -c asyncio.iscoroutinefunction→ 0; 166##[warning]lines remain, all of them the two classes above.