Skip to content

Commit a0580c6

Browse files
cliffhallclaude
andcommitted
docs(testing): describe time's in-process harness and coverage command
The skill still said no Python test opens a ClientSession, that time lacks pytest-asyncio, and that no Python server has coverage tooling; this PR made all three false for time. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent 49eeb28 commit a0580c6

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

‎.claude/skills/testing/SKILL.md‎

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ Driving a running server by hand, with the Inspector or an LLM client, is
1616
`/client-smoke`. It is evidence for a PR, not a substitute for a test.
1717

1818
⚠️ **The harnesses are uneven, and this page describes them as they are.** Only
19-
`everything` can be driven in-process today. A shared in-process harness for
20-
every server, and a per-file coverage threshold, are the work of #4854
21-
(TypeScript) and #4855 (Python); neither exists yet, and this skill changes
22-
when they land. Do not write a test that assumes them.
19+
`everything` and `time` can be driven in-process today. A shared in-process
20+
harness for every server, and an enforced per-file coverage threshold, are the
21+
work of #4854 (TypeScript) and #4855 (Python); neither is complete yet, and
22+
this skill changes when they land. Do not write a test that assumes them.
2323

2424
## Where a test goes
2525

@@ -42,10 +42,10 @@ helpers go in `__tests__/` without the `.test` suffix, as
4242
| `filesystem` | Unit tests of `lib.ts` and the path helpers, plus an SDK `Client` over `StdioClientTransport` that spawns the built `dist/index.js` |
4343
| `sequentialthinking` | Unit tests of `lib.ts`, plus an SDK `Client` over stdio against `dist/index.js` |
4444
| `memory` | Direct calls on the exported `KnowledgeGraphManager` and `register…` functions, with a mocked server |
45-
| `fetch`, `git`, `time` | Direct calls on the functions in `server.py`, with `unittest.mock` |
45+
| `fetch`, `git` | Direct calls on the functions in `server.py`, with `unittest.mock` |
46+
| `time` | A `ClientSession` against `serve()` in-process, over in-memory streams (`tests/test_protocol.py`); direct calls on the helpers in `server.py` (`tests/test_server.py`) |
4647

47-
No test in the repo uses an in-memory transport yet, and no Python test opens
48-
a `ClientSession`.
48+
Of the Python servers, only `time` opens a `ClientSession` in its tests.
4949

5050
## Choosing a harness for a new test
5151

@@ -170,8 +170,11 @@ built".
170170
### Python: `ClientSession` over stdio
171171

172172
Each Python server constructs its `Server` inside `serve()`, so it cannot be
173-
handed to an in-memory session. A protocol-level test spawns the module and
174-
talks to it through the SDK's stdio client:
173+
handed to an in-memory session directly. `time` drives it in-process anyway, by
174+
patching `stdio_server` to yield the server side of
175+
`create_client_server_memory_streams()`; see the `serving()` helper in
176+
`src/time/tests/test_protocol.py`. The other route spawns the module and talks
177+
to it through the SDK's stdio client:
175178

176179
```python
177180
import sys
@@ -201,8 +204,8 @@ def test_get_current_time_over_stdio() -> None:
201204
and the install there is editable, so this runs your edit with no build step.
202205

203206
How an async test is written differs by server, because the dev dependencies
204-
do: `fetch` has `pytest-asyncio` with `asyncio_mode = "auto"`, so an
205-
`async def test_…` just works. `git` and `time` do not have it; wrap the
207+
do: `fetch` and `time` have `pytest-asyncio` with `asyncio_mode = "auto"`,
208+
so an `async def test_…` just works. `git` does not have it; wrap the
206209
coroutine in `anyio.run(...)` as above (`git`'s `serve()` test does), rather
207210
than adding a dependency for one test.
208211

@@ -236,8 +239,9 @@ npm run coverage # all four
236239

237240
Today the report is **informational**. No vitest config sets a threshold, so
238241
`coverage` fails only when a test fails, and neither `validate` nor CI runs it.
239-
The Python servers have no coverage tooling at all: `pytest-cov` is not a dev
240-
dependency of any of them. Read the report to find what a change left
242+
Of the Python servers, only `time` has coverage tooling so far: its README's
243+
**Development** section gives the command, which writes `coverage.json`.
244+
Nothing enforces a threshold on it yet. Read the report to find what a change left
241245
untested; do not describe it as a gate.
242246

243247
⚠️ **A spawned server is invisible to the report.** v8 coverage measures the

0 commit comments

Comments
 (0)