Skip to content

Commit ced364e

Browse files
committed
Make the prompt test's opaque coverage workaround explicit
The never-called prompt body in the wrong-type-argument test proves it never ran by appending to a closure-captured list, but a plain append on an unreachable line would fail the 100% coverage gate. The append therefore rides on a `raise NotImplementedError` line, which coverage's `exclude_also` strips. That shape read as an accident; add a comment spelling out why it is written that way.
1 parent cf7b17f commit ced364e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

tests/interaction/mcpserver/test_prompts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ async def test_get_prompt_with_a_wrong_type_argument_is_rejected_before_the_func
130130
@mcp.prompt()
131131
def repeat(phrase: str, count: int) -> str:
132132
"""A registered prompt; type validation rejects the call before the function runs."""
133+
# Never runs: validate_call rejects the bad count first; `called == []` below is the
134+
# proof. The append rides on the coverage-excluded `raise NotImplementedError` line.
133135
raise NotImplementedError(called.append((phrase, count)))
134136

135137
async with connect(mcp) as client:

0 commit comments

Comments
 (0)