Skip to content

Commit 247e33e

Browse files
committed
coverage: ignore leftover test case issues
1 parent 95c6960 commit 247e33e

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/mcp/client/streamable_http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ async def _handle_resumption_request(self, ctx: RequestContext) -> None:
242242
event_source.response.raise_for_status()
243243
logger.debug("Resumption GET SSE connection established")
244244

245-
async for sse in event_source.aiter_sse():
245+
async for sse in event_source.aiter_sse(): # pragma: no branch
246246
is_complete = await self._handle_sse_event(
247247
sse,
248248
ctx.read_stream_writer,

src/mcp/shared/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ async def _receive_loop(self) -> None:
425425
# This is expected when the client disconnects abruptly.
426426
# Without this handler, the exception would propagate up and
427427
# crash the server's task group.
428-
logging.debug("Read stream closed by client")
428+
logging.debug("Read stream closed by client") # pragma: no cover
429429
except Exception as e: # pragma: no cover
430430
# Other exceptions are not expected and should be logged. We purposefully
431431
# catch all exceptions here to avoid crashing the server.

tests/client/test_stdio.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ async def test_basic_child_process_cleanup(self):
303303
assert os.path.exists(parent_marker), "Parent process didn't start"
304304

305305
# Verify child is writing
306-
if os.path.exists(marker_file):
306+
if os.path.exists(marker_file): # pragma: no branch
307307
initial_size = os.path.getsize(marker_file)
308308
await anyio.sleep(0.3)
309309
size_after_wait = os.path.getsize(marker_file)
@@ -318,7 +318,7 @@ async def test_basic_child_process_cleanup(self):
318318

319319
# Verify processes stopped
320320
await anyio.sleep(0.5)
321-
if os.path.exists(marker_file):
321+
if os.path.exists(marker_file): # pragma: no branch
322322
size_after_cleanup = os.path.getsize(marker_file)
323323
await anyio.sleep(0.5)
324324
final_size = os.path.getsize(marker_file)
@@ -335,7 +335,7 @@ async def test_basic_child_process_cleanup(self):
335335
for f in [marker_file, parent_marker]:
336336
try:
337337
os.unlink(f)
338-
except OSError:
338+
except OSError: # pragma: no cover
339339
pass
340340

341341
@pytest.mark.anyio
@@ -406,7 +406,7 @@ async def test_nested_process_tree(self):
406406

407407
# Verify all are writing
408408
for file_path, name in [(parent_file, "parent"), (child_file, "child"), (grandchild_file, "grandchild")]:
409-
if os.path.exists(file_path):
409+
if os.path.exists(file_path): # pragma: no branch
410410
initial_size = os.path.getsize(file_path)
411411
await anyio.sleep(0.3)
412412
new_size = os.path.getsize(file_path)
@@ -420,7 +420,7 @@ async def test_nested_process_tree(self):
420420
# Verify all stopped
421421
await anyio.sleep(0.5)
422422
for file_path, name in [(parent_file, "parent"), (child_file, "child"), (grandchild_file, "grandchild")]:
423-
if os.path.exists(file_path):
423+
if os.path.exists(file_path): # pragma: no branch
424424
size1 = os.path.getsize(file_path)
425425
await anyio.sleep(0.3)
426426
size2 = os.path.getsize(file_path)
@@ -433,7 +433,7 @@ async def test_nested_process_tree(self):
433433
for f in [parent_file, child_file, grandchild_file]:
434434
try:
435435
os.unlink(f)
436-
except OSError:
436+
except OSError: # pragma: no cover
437437
pass
438438

439439
@pytest.mark.anyio
@@ -487,7 +487,7 @@ def handle_term(sig, frame):
487487
await anyio.sleep(0.5)
488488

489489
# Verify child is writing
490-
if os.path.exists(marker_file):
490+
if os.path.exists(marker_file): # pragma: no cover
491491
size1 = os.path.getsize(marker_file)
492492
await anyio.sleep(0.3)
493493
size2 = os.path.getsize(marker_file)
@@ -500,7 +500,7 @@ def handle_term(sig, frame):
500500

501501
# Verify child stopped
502502
await anyio.sleep(0.5)
503-
if os.path.exists(marker_file):
503+
if os.path.exists(marker_file): # pragma: no branch
504504
size3 = os.path.getsize(marker_file)
505505
await anyio.sleep(0.3)
506506
size4 = os.path.getsize(marker_file)
@@ -512,7 +512,7 @@ def handle_term(sig, frame):
512512
# Clean up marker file
513513
try:
514514
os.unlink(marker_file)
515-
except OSError:
515+
except OSError: # pragma: no cover
516516
pass
517517

518518

@@ -560,7 +560,7 @@ async def test_stdio_client_graceful_stdin_exit():
560560
pytest.fail(
561561
"stdio_client cleanup timed out after 5.0 seconds. "
562562
"Process should have exited gracefully when stdin was closed."
563-
)
563+
) # pragma: no cover
564564

565565
end_time = time.time()
566566
elapsed = end_time - start_time
@@ -619,7 +619,7 @@ def sigterm_handler(signum, frame):
619619
pytest.fail(
620620
"stdio_client cleanup timed out after 7.0 seconds. "
621621
"Process should have been terminated via SIGTERM escalation."
622-
)
622+
) # pragma: no cover
623623

624624
end_time = time.time()
625625
elapsed = end_time - start_time

tests/server/fastmcp/resources/test_file_resources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ async def test_missing_file_error(self, temp_file: Path):
102102

103103
@pytest.mark.skipif(os.name == "nt", reason="File permissions behave differently on Windows")
104104
@pytest.mark.anyio
105-
async def test_permission_error(self, temp_file: Path):
105+
async def test_permission_error(self, temp_file: Path): # pragma: no cover
106106
"""Test reading a file without permissions."""
107107
temp_file.chmod(0o000) # Remove all permissions
108108
try:

0 commit comments

Comments
 (0)