Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
5437d7f
1
Parent(s): f15f08b
Fix import and remaining available port
Browse files
src/fastmcp/utilities/tests.py
CHANGED
|
@@ -11,6 +11,7 @@ from typing import TYPE_CHECKING, Any, Literal
|
|
| 11 |
import uvicorn
|
| 12 |
|
| 13 |
from fastmcp.settings import settings
|
|
|
|
| 14 |
|
| 15 |
if TYPE_CHECKING:
|
| 16 |
from fastmcp.server.server import FastMCP
|
|
@@ -84,9 +85,7 @@ def run_server_in_process(
|
|
| 84 |
The server URL.
|
| 85 |
"""
|
| 86 |
host = "127.0.0.1"
|
| 87 |
-
|
| 88 |
-
s.bind((host, 0))
|
| 89 |
-
port = s.getsockname()[1]
|
| 90 |
|
| 91 |
proc = multiprocessing.Process(
|
| 92 |
target=server_fn, args=(host, port, *args), daemon=True
|
|
|
|
| 11 |
import uvicorn
|
| 12 |
|
| 13 |
from fastmcp.settings import settings
|
| 14 |
+
from fastmcp.utilities.http import find_available_port
|
| 15 |
|
| 16 |
if TYPE_CHECKING:
|
| 17 |
from fastmcp.server.server import FastMCP
|
|
|
|
| 85 |
The server URL.
|
| 86 |
"""
|
| 87 |
host = "127.0.0.1"
|
| 88 |
+
port = find_available_port()
|
|
|
|
|
|
|
| 89 |
|
| 90 |
proc = multiprocessing.Process(
|
| 91 |
target=server_fn, args=(host, port, *args), daemon=True
|
tests/auth/test_oauth_client.py
CHANGED
|
@@ -11,7 +11,7 @@ import fastmcp.client.auth # Import module, not the function directly
|
|
| 11 |
from fastmcp.client import Client
|
| 12 |
from fastmcp.client.transports import StreamableHttpTransport
|
| 13 |
from fastmcp.server.auth.auth import ClientRegistrationOptions
|
| 14 |
-
from fastmcp.server.auth.
|
| 15 |
from fastmcp.server.server import FastMCP
|
| 16 |
from fastmcp.utilities.tests import run_server_in_process
|
| 17 |
|
|
|
|
| 11 |
from fastmcp.client import Client
|
| 12 |
from fastmcp.client.transports import StreamableHttpTransport
|
| 13 |
from fastmcp.server.auth.auth import ClientRegistrationOptions
|
| 14 |
+
from fastmcp.server.auth.in_memory_provider import InMemoryOAuthProvider as InMemory
|
| 15 |
from fastmcp.server.server import FastMCP
|
| 16 |
from fastmcp.utilities.tests import run_server_in_process
|
| 17 |
|