crafting-table/mcp/tests/conftest.py
Kayos ecb9d76e6d v0.1 wave 2B (step 7): MCP server — stdio JSON-RPC, 8 tools
- mcp/ subpackage: crafting-table-mcp (separate pip install)
- Self-contained requests-based HTTP client (mirrors clawdforge_mcp pattern)
- 8 tools: list_projects / register_project / run_audit / run_build / run_test / get_job / get_findings / draft_patch (stub)
- draft_patch is stubbed — full impl lands in wave 3 / step 9
- tests/: client + tool coverage, 401/404 surfacing
- Tools designed for LLM consumption; descriptions tuned for "when to use" guidance

Spec: memory/spec-crafting-table.md
2026-04-29 08:38:29 -07:00

39 lines
942 B
Python

"""Shared pytest fixtures for the crafting-table-mcp test suite.
Keeps each test module slim — every test wants a fresh ``CraftingTableClient``
pointed at the in-process ``responses`` mock and a tight timeout so a hung
test fails fast rather than hanging CI.
"""
from __future__ import annotations
import pytest
from crafting_table_mcp.client import CraftingTableClient
BASE_URL = "http://192.168.0.5:8810"
TOKEN = "ct_test_token_xxxxxxxx"
@pytest.fixture
def base_url() -> str:
return BASE_URL
@pytest.fixture
def token() -> str:
return TOKEN
@pytest.fixture
def client():
"""Yield a CraftingTableClient configured for the mock URL.
Closes the underlying ``requests.Session`` on test exit so a leaked
connection in one test doesn't contaminate the next one's mocks.
"""
c = CraftingTableClient(base_url=BASE_URL, token=TOKEN, timeout_secs=10)
try:
yield c
finally:
c.close()