Skip to content

Commit 0a37b26

Browse files
committed
fix: add pragma no cover to Protocol stubs and unreachable mock branch
Protocol stub methods (fetch_token, create_authorization_url, ensure_active_token) have Ellipsis bodies that coverage flags as uncovered branches because Protocol classes are never instantiated. Mark them with pragma: no cover. The fallback path in _mock_iterdir (returning original_iterdir when the path does not contain "fake") is only reachable on Windows where jsonschema lazily loads schemas during the test. On Linux/macOS jsonschema loads schemas eagerly so the branch is never taken. Mark it accordingly.
1 parent c27e10f commit 0a37b26

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/mcp/client/auth/authlib_adapter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ class _AsyncOAuth2ClientProtocol(Protocol):
6464
scope: str | None
6565
code_challenge_method: str
6666

67-
async def fetch_token(self, url: str, **kwargs: Any) -> dict[str, Any]: ...
67+
async def fetch_token(self, url: str, **kwargs: Any) -> dict[str, Any]: ... # pragma: no cover
6868

69-
def create_authorization_url(self, url: str, **kwargs: Any) -> tuple[str, str]: ...
69+
def create_authorization_url(self, url: str, **kwargs: Any) -> tuple[str, str]: ... # pragma: no cover
7070

71-
async def ensure_active_token(self, token: dict[str, Any]) -> None: ...
71+
async def ensure_active_token(self, token: dict[str, Any]) -> None: ... # pragma: no cover
7272

7373

7474
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)