Skip to content

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

Automatically Create inline Snapshots (#1779)

William Easton84eea7c708e8
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index cf5477d0c..76b78e46c 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -48,10 +48,10 @@ jobs:
run: uv sync --frozen
- name: Run tests (excluding integration and client_process)
- run: uv run pytest -v tests -m "not integration and not client_process"
+ run: uv run pytest --inline-snapshot=disable -v tests -m "not integration and not client_process"
- name: Run client process tests separately
- run: uv run pytest -v tests -m "client_process" -x
+ run: uv run pytest --inline-snapshot=disable -v tests -m "client_process" -x
run_integration_tests:
name: "Run integration tests"
diff --git a/AGENTS.md b/AGENTS.md
index 1a943175e..613b3752f 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -70,7 +70,7 @@ When modifying MCP functionality, changes typically need to be applied across al
### Inline Snapshots
-FastMCP uses `inline-snapshot` for testing complex data structures. On first run with empty `snapshot()`, pytest will auto-populate the expected value. To update snapshots after intentional changes, run `pytest --inline-snapshot=fix`. This is particularly useful for testing JSON schemas and API responses.
+FastMCP uses `inline-snapshot` for testing complex data structures. On first run with empty `snapshot()`, pytest will auto-populate the expected value when running `pytest --inline-snapshot=create`. To update snapshots after intentional changes, run `pytest --inline-snapshot=fix`. This is particularly useful for testing JSON schemas and API responses.
### Always Use In-Memory Transport
diff --git a/docs/development/tests.mdx b/docs/development/tests.mdx
index ae3241736..7263d7dea 100644
--- a/docs/development/tests.mdx
+++ b/docs/development/tests.mdx
@@ -211,7 +211,7 @@ Try not to have too many assertions in a single test unless you truly need to ch
#### Inline Snapshots
-FastMCP uses `inline-snapshot` for testing complex data structures. On first run with empty `snapshot()`, pytest will auto-populate the expected value. To update snapshots after intentional changes, run `pytest --inline-snapshot=fix`. This is particularly useful for testing JSON schemas and API responses.
+FastMCP uses `inline-snapshot` for testing complex data structures. On first run of `pytest --inline-snapshot=create` with an empty `snapshot()`, pytest will auto-populate the expected value. To update snapshots after intentional changes, run `pytest --inline-snapshot=fix`. This is particularly useful for testing JSON schemas and API responses.
```python
from inline_snapshot import snapshot
diff --git a/pyproject.toml b/pyproject.toml
index b222ef481..e02376c8b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -117,6 +117,7 @@ testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
+addopts = ["--inline-snapshot=disable"]
[tool.ty.src]
include = ["src", "tests"]