diff --git a/pyproject.toml b/pyproject.toml index 4f89956..9ecae01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,11 @@ dependencies = ["boto3>=1.40.0", "botocore>=1.43.0", "pyyaml>=6.0"] # and coverage; pytest-randomly surfaces cross-file import-order coupling. Install # with `pip install -e '.[test]'` (mirrors the Makefile/CI invocation). [project.optional-dependencies] -test = ["pytest>=8.0", "hypothesis>=6.0", "pytest-randomly>=3.15", "coverage>=7.0", "mcp>=1.0", "anyio[trio]>=4.0", "pytest-anyio>=0.0.0"] +# `tomli` is the 3.10-only TOML reader (stdlib `tomllib` arrives in 3.11). Without it the +# packaging tripwire — which reads pyproject.toml as data — silently SKIPPED its whole +# file on 3.10, the project's own declared minimum, taking the INV-MCP-2 wheel guard with +# it. Marker-gated so 3.11+ does not install a redundant dependency. +test = ["pytest>=8.0", "hypothesis>=6.0", "pytest-randomly>=3.15", "coverage>=7.0", "mcp>=1.0", "anyio[trio]>=4.0", "pytest-anyio>=0.0.0", "tomli>=2.0; python_version<'3.11'"] mcp = ["mcp>=1.0"] [project.scripts] diff --git a/tests/test_packaging.py b/tests/test_packaging.py index 1ee0738..cc18c6c 100644 --- a/tests/test_packaging.py +++ b/tests/test_packaging.py @@ -17,10 +17,21 @@ import pytest +# TOML reader. `tomllib` is stdlib from 3.11; on 3.10 — which `requires-python = ">=3.10"` +# declares as supported — the standard backport `tomli` provides the identical API. +# +# This used to be `tomllib = None` on 3.10, and the fixture skipped. The consequence was +# that EVERY test reading pyproject.toml — 7 of this file's 12, including the INV-MCP-2 +# packaging guard added in round 20 — was inert on the project's own minimum version. CI +# covers 3.11+ so the guard still had teeth there, but a guard that evaporates on the +# floor version is a guard with a documented hole in it. if sys.version_info >= (3, 11): import tomllib -else: # pragma: no cover — py3.10 fallback - tomllib = None +else: # pragma: no cover — py3.10 path, exercised in the 3.10 CI leg + try: + import tomli as tomllib # type: ignore[no-redef] + except ImportError: # pragma: no cover + tomllib = None # type: ignore[assignment] _REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) PYPROJECT = os.path.join(_REPO_ROOT, "pyproject.toml")