Skip to content

Commit 872cab6

Browse files
[PR #11056/7f691674 backport][3.12] Prevent blockbuster False Positives from coverage.py Locking (#11065)
Co-authored-by: J. Nick Koston <[email protected]>
1 parent 09396d0 commit 872cab6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ def blockbuster(request: pytest.FixtureRequest) -> Iterator[None]:
8080
bb.functions[func].can_block_in(
8181
"aiohttp/web_urldispatcher.py", "add_static"
8282
)
83+
# Note: coverage.py uses locking internally which can cause false positives
84+
# in blockbuster when it instruments code. This is particularly problematic
85+
# on Windows where it can lead to flaky test failures.
86+
# Additionally, we're not particularly worried about threading.Lock.acquire happening
87+
# by accident in this codebase as we primarily use asyncio.Lock for
88+
# synchronization in async code.
89+
# Allow lock.acquire calls to prevent these false positives
90+
bb.functions["threading.Lock.acquire"].deactivate()
8391
yield
8492

8593

0 commit comments

Comments
 (0)