Skip to content

Commit daf837c

Browse files
committed
docs: tighten coverage-pragma guidance
Drop the subprocess-flake bullet and the 'add this pragma' prescription for no-branch. Scope lax-no-cover to platform-specific coverage only.
1 parent 6165b2e commit daf837c

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

CLAUDE.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,14 @@ This document contains critical information about working with this codebase. Fo
4646
and `--include` scope the report. `strict-no-cover` has no false positives on
4747
partial runs — if your new test executes a line marked `# pragma: no cover`,
4848
even a single-file run catches it.
49-
- `strict-no-cover` can occasionally flag subprocess-runner functions in `tests/`
50-
on high-core machines (`-n auto` → racy subprocess coverage). If the flagged
51-
lines are inside a `tests/…/run_*server*()` body and unrelated to your change,
52-
re-run or convert that pragma to `lax no cover`. Flags in `src/` are real.
5349
- Coverage pragmas:
5450
- `# pragma: no cover` — line is never executed. CI's `strict-no-cover` fails if
5551
it IS executed. When your test starts covering such a line, remove the pragma.
5652
- `# pragma: lax no cover` — excluded from coverage but not checked by
5753
`strict-no-cover`. Use for lines covered on some platforms/versions but not
58-
others, or nondeterministically (races, subprocess coverage).
54+
others.
5955
- `# pragma: no branch` — excludes branch arcs only. coverage.py misreports the
6056
`->exit` arc for nested `async with` on Python 3.11+ (worse on 3.14/Windows).
61-
There is no local detector; when CI reports `X->exit` missing on a test line,
62-
add this pragma to line X.
6357
- Avoid `anyio.sleep()` with a fixed duration to wait for async operations. Instead:
6458
- Use `anyio.Event`set it in the callback/handler, `await event.wait()` in the test
6559
- For stream messages, use `await stream.receive()` instead of `sleep()` + `receive_nowait()`

0 commit comments

Comments
 (0)