test: add blockbuster to detect blocking calls in asyncio tests#1761
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1761 +/- ##
=======================================
Coverage 99.77% 99.77%
=======================================
Files 33 33
Lines 3509 3509
Branches 493 493
=======================================
Hits 3501 3501
Misses 5 5
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires
blockbusterinto anautouse fixture in
tests/conftest.pyso any synchronous IO thatslips into the asyncio event loop fails the test instead of going
unnoticed. Mirrors the integration just landed in
dbus-fast#690.Downstream consumers (Home Assistant in particular) keep catching
async-loop blockers for us; surfacing them in this repo's own CI is
cheap and forces the fix at the source.
Details
blockbuster = ">=1.5.5,<2.0.0"to the dev dependency group.blockbusterautouse fixture that wraps every non-benchmarktest in
blockbuster_ctx(). Benchmarks undertests/benchmarks/are skipped — CodSpeed runs there should measure real workload, not
pay the cost of monkeypatched builtins.
PyPy / QEMU matrix legs that don't install it).
pytest_collection_modifyitemsmarks entries in_KNOWN_BLOCKINGas
xfail(strict=False)so a future addition lands green and thelist shrinks over time as the underlying blocks are removed.
The only test the full suite trips on today is
tests/test_core.py::Framework::test_use_asyncio_false_forces_thread_when_loop_running,which is deliberately documenting the sync-bootstrap path that
Zeroconf(use_asyncio=False)takes from inside a running event loop(it blocks waiting for the loop thread to come up — the test pins
that behavior). It stays xfail by design; the comment on
_KNOWN_BLOCKINGcalls that out.Test plan