Skip to content

Commit 9dad266

Browse files
authored
Fix auth tests and ruff format (#818)
1 parent 6e418e6 commit 9dad266

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/mcp/client/session_group.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ async def __aexit__(
154154
for exit_stack in self._session_exit_stacks.values():
155155
tg.start_soon(exit_stack.aclose)
156156

157-
158157
@property
159158
def sessions(self) -> list[mcp.ClientSession]:
160159
"""Returns the list of sessions being managed."""

src/mcp/server/auth/routes.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,8 @@ def build_metadata(
153153
client_registration_options: ClientRegistrationOptions,
154154
revocation_options: RevocationOptions,
155155
) -> OAuthMetadata:
156-
authorization_url = AnyHttpUrl(
157-
str(issuer_url).rstrip("/") + AUTHORIZATION_PATH
158-
)
159-
token_url = AnyHttpUrl(
160-
str(issuer_url).rstrip("/") + TOKEN_PATH
161-
)
156+
authorization_url = AnyHttpUrl(str(issuer_url).rstrip("/") + AUTHORIZATION_PATH)
157+
token_url = AnyHttpUrl(str(issuer_url).rstrip("/") + TOKEN_PATH)
162158

163159
# Create metadata
164160
metadata = OAuthMetadata(

tests/client/test_auth.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ def test_has_valid_token_valid(self, oauth_provider, oauth_token):
359359

360360
assert oauth_provider._has_valid_token()
361361

362-
def test_has_valid_token_expired(self, oauth_provider, oauth_token):
362+
@pytest.mark.anyio
363+
async def test_has_valid_token_expired(self, oauth_provider, oauth_token):
363364
"""Test token validation with expired token."""
364365
oauth_provider._current_tokens = oauth_token
365366
oauth_provider._token_expiry_time = time.time() - 3600 # Past expiry
@@ -810,7 +811,8 @@ def test_scope_priority_no_client_metadata_scope(
810811
# No scope should be set since client metadata doesn't have explicit scope
811812
assert "scope" not in auth_params
812813

813-
def test_scope_priority_no_scope(self, oauth_provider, oauth_client_info):
814+
@pytest.mark.anyio
815+
async def test_scope_priority_no_scope(self, oauth_provider, oauth_client_info):
814816
"""Test that no scope parameter is set when no scopes specified."""
815817
oauth_provider.client_metadata.scope = None
816818
oauth_provider._client_info = oauth_client_info

0 commit comments

Comments
 (0)