Skip to content

Commit d3bdc5c

Browse files
committed
fix(tests): add pragma no branch to fix coverage false positive
The suppressing_handler in test_custom_message_handler_can_suppress_exceptions only ever receives Exception messages in the test, so coverage.py reports the False branch (792->exit) as uncovered. This is a known coverage.py quirk with async functions where one branch path is never taken by design. Adding # pragma: no branch restores 100% coverage. Github-Issue: #1401
1 parent 134bae3 commit d3bdc5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/client/test_session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ async def test_custom_message_handler_can_suppress_exceptions():
789789
async def suppressing_handler(
790790
message: RequestResponder[types.ServerRequest, types.ClientResult] | types.ServerNotification | Exception,
791791
) -> None:
792-
if isinstance(message, Exception):
792+
if isinstance(message, Exception): # pragma: no branch
793793
suppressed_exceptions.append(message)
794794
# Intentionally NOT re-raising — old silent behavior
795795

0 commit comments

Comments
 (0)