test: raise coverage 64% -> 90% with behavior-focused tests + enforced gate
New suites assert real behavior, not just that code runs: - test_types: workout serialization round-trips (recursive steps, camelCase keys, enum conversion) + __str__ formatting. - test_api_client: request construction (URL/method/auth/body) and the full HTTP status-code -> message mapping. - test_auth: RS256 JWT verification — valid -> AccessToken; expired/wrong-aud/ wrong-issuer/wrong-key/missing-claim -> None; audience slash variants. - test_server_setup: transport selection + start_server dispatch. - test_events / test_activities / test_custom_items: request payloads (create vs update, POST/PUT/DELETE), delete accounting, JSON-content parsing, and error/empty branches. Enforce >=90 via pytest --cov-fail-under=90; CI test job now gates the build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -31,7 +31,7 @@ keywords = ["intervals", "cycling", "running", "mcp", "ai"]
|
||||
"Upstream" = "https://github.com/mvilanova/intervals-mcp-server"
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = ["pytest>=8.3.5", "mypy>=1.0.0", "ruff>=0.1.0", "pytest-asyncio>=0.21", "pre-commit", "hatch", "pytest-mock==3.12.0"]
|
||||
dev = ["pytest>=8.3.5", "mypy>=1.0.0", "ruff>=0.1.0", "pytest-asyncio>=0.21", "pre-commit", "hatch", "pytest-mock==3.12.0", "pytest-cov>=5.0", "cryptography>=42.0"]
|
||||
|
||||
[tool.hatch.build]
|
||||
include = ["server.py", "utils/*.py", "README.md", ".env.example"]
|
||||
@@ -114,7 +114,7 @@ default.unicode = true
|
||||
default.locale = "en-us"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
addopts = "-q"
|
||||
addopts = "-q --cov=src/intervals_mcp_server --cov-report=term-missing --cov-fail-under=90"
|
||||
testpaths = ["tests"]
|
||||
python_files = "test_*.py"
|
||||
asyncio_default_fixture_loop_scope = "function"
|
||||
|
||||
Reference in New Issue
Block a user