Python 3.14 CI: ~25k `asyncio.get_event_loop_policy` / `set_event_loop_policy` deprecation warnings, all from the pinned pytest-asyncio 0.26
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 25/100
Research direction
The warnings come from the pinned pytest-asyncio 0.26 in the testing dependency group in pyproject.toml (line 51), so the pin is the place to look. The fix is already in draft PR #695, which changes the pin and adapts tests/conftest.py away from the removed event_loop fixture; start by reading that diff and PR #776 rather than starting fresh. Done means the Python 3.14 CI job no longer shows the policy deprecation annotations and the test suite still passes.
Written by the indexing model from the issue text.
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.
- #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. - #695 — Bump pytest-asyncio to 1.3.0 (draft). This is the one that fixes this issue. Brought up to date in 9f981514: 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. - #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. - #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
- 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. - 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 c556ae20 on 2026-09-20.
- Dominant language
- Python
- Stars
- 96
- Forks
- 84
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 30
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from zigpy/zha
-
Device override creates the generic entity instead of the vendor-specific one (Light instead of HueLight, ForceOnLight, MinTransitionLight)Possibly taken @zigpy-review-bot claimed this today. Openbot: code audit
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Each time a device becomes available again, ZHA adds another firmware update listener that is never releasedPossibly taken @zigpy-review-bot claimed this 1 day ago. Openbot: code audit
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Devices that left the network are re-initialized on every availability check, reading attributes from a device that is gonePossibly taken @zigpy-review-bot claimed this 1 day ago. Openbot: code audit
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
device specific quirks
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pimutils/vdirsyncer#1242 ·
-
priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
QuantConnect/lean-cli#792 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
open-webui/open-webui#35360 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Suggest link: Destiny Verify (MIT zero-dependency pre-commit security, citation & link hygiene CLI)Open
Difficulty 1/5 Under an hour Newbie friendliness 68/100