Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Conftest.py for the docs tree's doctest collection.

``fastmcp`` is a dev dependency on Python 3.11+ only, so the demo server that
imports it cannot be collected without it.
"""

from __future__ import annotations

import importlib.util

collect_ignore: list[str] = []

if importlib.util.find_spec("fastmcp") is None:
collect_ignore.append("_ext/fastmcp_demo_server.py")
18 changes: 16 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ dev = [
# which no shim reproduces faithfully — an SDK field rename is invisible
# to a hand-written stub. Dev-only: the extension keeps working without
# FastMCP installed, and its real-object tests skip when it is absent.
"fastmcp>=4.0.2",
"fastmcp>=4.0.2; python_version >= '3.11'",
"pytest",
"pytest-asyncio",
"pytest-rerunfailures",
"pytest-mock",
"pytest-watcher",
"pytest-playwright",
"pillow",
"pillow>=13; python_version >= '3.11'",
# Coverage
"codecov",
"coverage",
Expand Down Expand Up @@ -138,6 +138,20 @@ ignore_errors = true
module = ["fastmcp", "fastmcp.*"]
ignore_missing_imports = true

[[tool.mypy.overrides]]
# pillow and fastmcp (with its pydantic and mcp dependencies) are installed
# on Python 3.11+ only, so on 3.10 these modules type-check against Any.
module = ["PIL", "PIL.*", "pydantic", "pydantic.*", "mcp", "mcp.*"]
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = [
"tests.ext.fastmcp.test_real_server",
"tests.visual.test_visual_regression",
"fastmcp_demo_server",
]
disable_error_code = ["misc", "no-any-return", "untyped-decorator"]

[tool.ruff]
target-version = "py310"
extend-exclude = [
Expand Down
6 changes: 5 additions & 1 deletion tests/visual/test_visual_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
import typing as t

import pytest
from PIL import Image, ImageChops
from playwright.sync_api import Page

# Pillow is scoped to Python 3.11+ in the dev group; skip the module without it.
pytest.importorskip("PIL")

from PIL import Image, ImageChops

_BASELINE_DIR = (
pathlib.Path(__file__).resolve().parent / "__snapshots__" / "baseline-scss"
)
Expand Down
Loading
Loading