tests: add missing init files (#1831)

This commit is contained in:
Marcelo Trylesinski 2026-01-06 19:52:09 +01:00 • committed by GitHub
commit 6149b63a44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 5 additions and 21 deletions

View file

@ -12,19 +12,13 @@ import sys
import tempfile import tempfile
import textwrap import textwrap
from pathlib import Path from pathlib import Path
from typing import TYPE_CHECKING
import anyio import anyio
import pytest import pytest
from mcp import ClientSession, StdioServerParameters from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import _create_platform_compatible_process, stdio_client from mcp.client.stdio import _create_platform_compatible_process, stdio_client
from tests.shared.test_win32_utils import escape_path_for_python
# TODO(Marcelo): This doesn't seem to be the right path. We should fix this.
if TYPE_CHECKING:
from ..shared.test_win32_utils import escape_path_for_python
else:
from tests.shared.test_win32_utils import escape_path_for_python
@pytest.mark.anyio @pytest.mark.anyio

View file

View file

View file

@ -3,7 +3,7 @@ Tests for OAuth error handling in the auth handlers.
""" """
import unittest.mock import unittest.mock
from typing import TYPE_CHECKING, Any from typing import Any
from urllib.parse import parse_qs, urlparse from urllib.parse import parse_qs, urlparse
import httpx import httpx
@ -14,12 +14,7 @@ from starlette.applications import Starlette
from mcp.server.auth.provider import AuthorizeError, RegistrationError, TokenError from mcp.server.auth.provider import AuthorizeError, RegistrationError, TokenError
from mcp.server.auth.routes import create_auth_routes from mcp.server.auth.routes import create_auth_routes
from tests.server.fastmcp.auth.test_auth_integration import MockOAuthProvider
# TODO(Marcelo): This TYPE_CHECKING shouldn't be here, but pytest doesn't seem to get the module correctly.
if TYPE_CHECKING:
from ...server.fastmcp.auth.test_auth_integration import MockOAuthProvider
else:
from tests.server.fastmcp.auth.test_auth_integration import MockOAuthProvider
@pytest.fixture @pytest.fixture

View file

@ -1,6 +1,6 @@
import base64 import base64
from pathlib import Path from pathlib import Path
from typing import TYPE_CHECKING, Any from typing import Any
from unittest.mock import patch from unittest.mock import patch
import pytest import pytest
@ -14,9 +14,7 @@ from mcp.server.fastmcp.utilities.types import Audio, Image
from mcp.server.session import ServerSession from mcp.server.session import ServerSession
from mcp.server.transport_security import TransportSecuritySettings from mcp.server.transport_security import TransportSecuritySettings
from mcp.shared.exceptions import McpError from mcp.shared.exceptions import McpError
from mcp.shared.memory import ( from mcp.shared.memory import create_connected_server_and_client_session as client_session
create_connected_server_and_client_session as client_session,
)
from mcp.types import ( from mcp.types import (
AudioContent, AudioContent,
BlobResourceContents, BlobResourceContents,
@ -27,9 +25,6 @@ from mcp.types import (
TextResourceContents, TextResourceContents,
) )
if TYPE_CHECKING:
from mcp.server.fastmcp import Context
class TestServer: class TestServer:
@pytest.mark.anyio @pytest.mark.anyio

0
tests/shared/__init__.py Normal file
View file