URLs, mount paths, and LAN host bindings parameterized via env or relative paths
so the repo stands up from a clean clone anywhere. Drop cross-codebase refs
("mirrors clawdforge's pattern"), Sulkta-Coop client/merchant test fixtures,
and audit-changelog scaffolding from comments. README terser, technical content
preserved.
39 lines
950 B
Python
39 lines
950 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://crafting-table.test: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()
|