Skip to content

Commit

Permalink
tests: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dsp-ant committed Feb 5, 2025
1 parent c58adfe commit f10665d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 28 deletions.
28 changes: 0 additions & 28 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
import pytest
from pydantic import AnyUrl

from mcp.server.lowlevel import Server
from mcp.server.models import InitializationOptions
from mcp.types import Resource, ServerCapabilities

TEST_INITIALIZATION_OPTIONS = InitializationOptions(
server_name="my_mcp_server",
server_version="0.1.0",
capabilities=ServerCapabilities(),
)


@pytest.fixture
def mcp_server() -> Server:
server = Server(name="test_server")

@server.list_resources()
async def handle_list_resources():
return [
Resource(
uri=AnyUrl("memory://test"),
name="Test Resource",
description="A test resource",
)
]

return server


@pytest.fixture
Expand Down
19 changes: 19 additions & 0 deletions tests/shared/test_memory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from pydantic import AnyUrl
from typing_extensions import AsyncGenerator

from mcp.client.session import ClientSession
Expand All @@ -8,9 +9,27 @@
)
from mcp.types import (
EmptyResult,
Resource,
)


@pytest.fixture
def mcp_server() -> Server:
server = Server(name="test_server")

@server.list_resources()
async def handle_list_resources():
return [
Resource(
uri=AnyUrl("memory://test"),
name="Test Resource",
description="A test resource",
)
]

return server


@pytest.fixture
async def client_connected_to_server(
mcp_server: Server,
Expand Down

0 comments on commit f10665d

Please sign in to comment.