Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

fix(tests): hoist azure-identity import out of the OBO test timeout window (#4176)

Bill Easton11951585c015
diff --git a/tests/server/auth/providers/test_azure_scopes.py b/tests/server/auth/providers/test_azure_scopes.py
index 8ab35431d..5f1bb6b18 100644
--- a/tests/server/auth/providers/test_azure_scopes.py
+++ b/tests/server/auth/providers/test_azure_scopes.py
@@ -12,6 +12,14 @@ from fastmcp.server.auth.providers.azure import (
)
from fastmcp.server.auth.providers.jwt import RSAKeyPair, StaticTokenVerifier
+# Import the optional azure-identity SDK once, at collection time. The OBO
+# tests mock it via patch("azure.identity.aio.OnBehalfOfCredential"), but the
+# provider imports it lazily β€” so without this the heavy SDK import lands
+# inside the first OBO test's 5s pytest-timeout window and flakes on cold
+# Windows runners (#4175). importorskip also skips cleanly if the optional
+# `azure` extra is absent, instead of hard-failing at runtime.
+pytest.importorskip("azure.identity.aio")
+
@pytest.fixture
def memory_storage() -> MemoryStore: