mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-16 10:39:11 +02:00
42 lines
1.2 KiB
Text
42 lines
1.2 KiB
Text
---
|
|
title: tests
|
|
sidebarTitle: tests
|
|
---
|
|
|
|
# `fastmcp.utilities.tests`
|
|
|
|
## Functions
|
|
|
|
### `temporary_settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L21"><Icon icon="github" size="14" /></a></sup>
|
|
|
|
```python
|
|
temporary_settings(**kwargs: Any)
|
|
```
|
|
|
|
|
|
Temporarily override FastMCP setting values.
|
|
|
|
**Args:**
|
|
- `**kwargs`: The settings to override, including nested settings.
|
|
|
|
|
|
### `run_server_in_process` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L74"><Icon icon="github" size="14" /></a></sup>
|
|
|
|
```python
|
|
run_server_in_process(server_fn: Callable[..., None], *args, **kwargs) -> Generator[str, None, None]
|
|
```
|
|
|
|
|
|
Context manager that runs a FastMCP server in a separate process and
|
|
returns the server URL. When the context manager is exited, the server process is killed.
|
|
|
|
**Args:**
|
|
- `server_fn`: The function that runs a FastMCP server. FastMCP servers are
|
|
not pickleable, so we need a function that creates and runs one.
|
|
- `*args`: Arguments to pass to the server function.
|
|
- `provide_host_and_port`: Whether to provide the host and port to the server function as kwargs.
|
|
- `**kwargs`: Keyword arguments to pass to the server function.
|
|
|
|
**Returns:**
|
|
- The server URL.
|
|
|