Skip to content

Commit 3e53636

Browse files
committed
Exclude the connection loop's exit arc from branch coverage
The arc fires after the final async-with teardown, inside the same Python 3.11 trace-loss shadow as the previous commit; only the arc is excluded, the loop body stays measured.
1 parent b732867 commit 3e53636

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/shared/test_sse.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,10 @@ async def test_request_context_isolation() -> None:
375375
# Connect three clients in turn, each with its own headers. Each connection is
376376
# verified inside its own block: on Python 3.11 the line tracer is lost once an
377377
# async-with teardown throws (python/cpython#106749), so statements placed after
378-
# this loop would be reported uncovered on some matrix cells.
379-
for i in range(3):
378+
# this loop would be reported uncovered on some matrix cells. The loop's exit
379+
# arc fires after the final teardown and sits in the same shadow, hence the
380+
# branch exclusion.
381+
for i in range(3): # pragma: no branch
380382
headers = {"X-Request-Id": f"request-{i}", "X-Custom-Value": f"value-{i}"}
381383

382384
async with sse_client(f"{BASE_URL}/sse", httpx_client_factory=factory, headers=headers) as streams:

0 commit comments

Comments
 (0)