Files
cAIc/tests/conftest.py
T
gramps 44387919a8 v0.17.3: bug-fix maintenance pass — ingest origin exemption, FK safety, auto-search reset, deterministic ingest, WAL, config centralization, dead-code removal
- /api/ingest exempt from origin check for CLI/Bearer clients
- recreate deleted conversations on bogus conversation_id (chat + search)
- augmented auto-search emits reset:true; frontend clears first-pass text
- image uploads stored as placeholders, never text-ingested
- check_fact_conflicts requires shared subject keywords
- deterministic ingest point ids (md5 chunk hash)
- get_load() no longer crashes when rocm-smi yields no VRAM lines
- SQLite WAL + busy_timeout; timing-safe API key compares
- supervise fire-and-forget auto-ingest tasks; log missing logprobs
- centralize EMBED_URL/EMBED_MODEL/QDRANT_URL/NODE_NAME in config
- remove dead triage.py, select_node tests, is_state_changing, stray artifacts
- add regression tests + autouse global-reset conftest
2026-08-07 15:17:47 -07:00

35 lines
1.0 KiB
Python

# Ensure the project root is on sys.path so that test modules can import
# top-level packages (app, amqp, cluster, config, …) without PYTHONPATH hacks.
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
"""Shared pytest fixtures.
All test modules manipulate in-process globals (sessions, rate buckets,
cluster registry, eviction log). An autouse fixture resets every global
before each test so no state leaks between tests, regardless of whether an
individual test file remembers to clear it.
"""
import pytest
import cluster
import routers.chat
from eviction import EVICTION_LOG
from security import SESSIONS, PIN_ATTEMPTS, RATE_EVENTS
@pytest.fixture(autouse=True)
def _reset_global_state():
SESSIONS.clear()
PIN_ATTEMPTS.clear()
RATE_EVENTS.clear()
cluster.CLUSTER_NODES.clear()
cluster.CLUSTER_EVENTS.clear()
cluster.CLUSTER_COORDINATOR = None
cluster._pending_pings.clear()
EVICTION_LOG.clear()
routers.chat._ingest_tasks.clear()
yield