Files
can-you-assist/tests/conftest.py
tegwick f15d253e64 feat(shell): add interactive cya shell session (CYA-WP-0007)
Implement the full interactive shell REPL with session persistence,
opt-in capped/redacted shell history, State Hub orientation and
explicit slash-command writes, orchestrator/safety wiring, end-session
learning hooks, weakness hints, docs, and tests.
2026-06-24 14:53:18 +02:00

47 lines
1.6 KiB
Python

"""Pytest configuration and fixtures for can-you-assist (T07).
Safety-focused tests live here. All tests should be fast and hermetic.
No live LLM or network required for the default run.
"""
import pytest
# Future: common fixtures for envelopes, fake adapters, etc.
# For now this file exists to establish the test layout.
# The llm-connect integration tests mock llm_connect symbols. When the optional
# sibling package is not installed in a default dev checkout, provide a tiny
# import target so unittest.mock.patch can attach to it. Real installations win.
def pytest_configure(config):
import importlib.util
import sys
import types
if importlib.util.find_spec("llm_connect") is not None:
return
if "llm_connect" in sys.modules:
return
llm_connect = types.ModuleType("llm_connect")
llm_config = types.ModuleType("llm_connect.config")
llm_models = types.ModuleType("llm_connect.models")
class RunConfig:
def __init__(self, *, model_name, temperature, max_tokens):
self.model_name = model_name
self.temperature = temperature
self.max_tokens = max_tokens
def _missing_create_adapter(*args, **kwargs):
raise RuntimeError("llm_connect test stub was not patched")
llm_connect.create_adapter = _missing_create_adapter
llm_config.resolve_api_key = lambda env_var=None: None
llm_models.RunConfig = RunConfig
llm_connect.config = llm_config
llm_connect.models = llm_models
sys.modules["llm_connect"] = llm_connect
sys.modules["llm_connect.config"] = llm_config
sys.modules["llm_connect.models"] = llm_models