Skip to content

Commit 3f4e93d

Browse files
author
Sanjay
committed
Refactor concurrency test assertions for clarity and improved logging
1 parent a41bb8d commit 3f4e93d

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

tests/client/test_auth.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import httpx
1212
import pytest
13-
from inline_snapshot import snapshot
1413
from pydantic import AnyHttpUrl
1514

1615
from mcp.client.auth import OAuthClientProvider
@@ -997,8 +996,17 @@ def test_build_metadata(
997996
assert str(metadata.registration_endpoint) == str(expected.registration_endpoint)
998997
assert metadata.scopes_supported == expected.scopes_supported
999998
assert metadata.grant_types_supported == expected.grant_types_supported
1000-
assert metadata.token_endpoint_auth_methods_supported == expected.token_endpoint_auth_methods_supported
999+
assert (
1000+
metadata.token_endpoint_auth_methods_supported
1001+
== expected.token_endpoint_auth_methods_supported
1002+
)
10011003
assert str(metadata.service_documentation) == str(expected.service_documentation)
10021004
assert str(metadata.revocation_endpoint) == str(expected.revocation_endpoint)
1003-
assert metadata.revocation_endpoint_auth_methods_supported == expected.revocation_endpoint_auth_methods_supported
1004-
assert metadata.code_challenge_methods_supported == expected.code_challenge_methods_supported
1005+
assert (
1006+
metadata.revocation_endpoint_auth_methods_supported
1007+
== expected.revocation_endpoint_auth_methods_supported
1008+
)
1009+
assert (
1010+
metadata.code_challenge_methods_supported
1011+
== expected.code_challenge_methods_supported
1012+
)

tests/issues/test_188_concurrency.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ async def slow_resource():
3737
duration = end_time - start_time
3838
# 20 tasks (10 tools + 10 resources) should complete in significantly less time
3939
# than if they were executed serially (which would take 20 * sleep_time)
40-
assert duration < 12 * _sleep_time_seconds # Increased threshold for CI environments
41-
print(f"Concurrent execution duration: {duration}, threshold: {12 * _sleep_time_seconds}")
40+
# Increased threshold for CI environments
41+
assert duration < 12 * _sleep_time_seconds
42+
threshold = 12 * _sleep_time_seconds
43+
print(f"Concurrent execution duration: {duration}, threshold: {threshold}")
4244

4345

4446
def main():

0 commit comments

Comments
 (0)