Files
factory/lib/interns-mcp/tests/test_client.py
vitya ca669d96e1 feat(lib): bundle MCP servers from .common/lib into factory/lib/
Copies source (no node_modules, dist, .tasks, .wiki, __pycache__) for:
- projects-meta-mcp v2.25.0 (TypeScript/Node)
- wiki-graph v0.3.1 (TypeScript/Node)
- interns-mcp v0.3.3 (Python/FastMCP)

.gitignore: exclude lib build artefacts (node_modules, dist, .venv, __pycache__, *.pyc)
bootstrap.ps1: add MCP build step — npm install+build for TS servers, venv+pip for Python

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 13:17:29 +03:00

22 lines
877 B
Python

"""Tests for HTTP client construction — esp. the request timeout that bounds
LLM calls so a stalled endpoint can never hang a worker thread forever."""
from interns_mcp.client import make_client, _resolve_timeout, DEFAULT_REQUEST_TIMEOUT
def test_default_timeout_is_bounded():
# A bare endpoint config must still get a finite, short-ish timeout —
# the OpenAI SDK default (600s) is long enough to wedge the server.
assert _resolve_timeout({}) == DEFAULT_REQUEST_TIMEOUT
assert DEFAULT_REQUEST_TIMEOUT <= 120
def test_configured_timeout_overrides_default():
assert _resolve_timeout({"request_timeout": 42}) == 42.0
def test_client_is_built_with_timeout():
c = make_client({"base_url": "http://example.invalid", "request_timeout": 30}, "k")
# OpenAI client exposes the configured timeout; must not be None.
assert c.timeout is not None