Skip to content

Commit 4ee690c

Browse files
committed
Replace the standalone-import test with an isolated install check in CI
tests/types/test_standalone.py modeled the contract by parsing imports with ast. A step in the pre-commit job now exercises the contract itself: `uv run --isolated --no-project --with ./src/mcp-types` resolves only the package's declared dependencies into an empty environment and imports every module, so a stray import of the SDK or anything from its stack is a ModuleNotFoundError. It also sits behind the blocking pre-commit job rather than the continue-on-error test matrix.
1 parent 2c2377a commit 4ee690c

2 files changed

Lines changed: 7 additions & 45 deletions

File tree

.github/workflows/shared.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ jobs:
3535
uv sync --group codegen --frozen
3636
uv run --frozen --group codegen python scripts/gen_surface_types.py --check
3737
38+
# Resolves only mcp-types' declared dependencies into an empty environment,
39+
# so an import of the SDK or anything from its stack fails here.
40+
- name: mcp-types installs and imports standalone
41+
run: |
42+
uv run --isolated --no-project --with ./src/mcp-types python -c \
43+
"import mcp_types, mcp_types.jsonrpc, mcp_types.methods, mcp_types.version, mcp_types.v2025_11_25, mcp_types.v2026_07_28"
44+
3845
# TODO(Max): Drop this in v2. Deliberate updates (e.g. the v2 status
3946
# banner) go through the 'override-readme-freeze' label.
4047
- name: Check README.md is not modified

tests/types/test_standalone.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)