feat: code quality audit + autoresearch integration + infra hardening (#150)

This commit is contained in:
Alexander Whitestone
2026-03-08 12:50:44 -04:00
committed by GitHub
parent fd0ede0d51
commit ae3bb1cc21
186 changed files with 5129 additions and 3289 deletions

View File

@@ -16,6 +16,10 @@ except ImportError:
# ── Stub heavy optional dependencies so tests run without them installed ──────
# Uses setdefault: real module is used if already installed, mock otherwise.
# Stub heavy optional dependencies so tests run without them installed.
# Uses setdefault: real module is used if already installed, mock otherwise.
# Note: only stub packages that are truly optional and may not be installed.
# Packages like typer, httpx, fastapi are required deps — never stub those.
for _mod in [
"agno",
"agno.agent",
@@ -31,7 +35,6 @@ for _mod in [
"discord.ext.commands",
"pyzbar",
"pyzbar.pyzbar",
"requests",
"pyttsx3",
"sentence_transformers",
]:
@@ -47,6 +50,7 @@ os.environ["TIMMY_SKIP_EMBEDDINGS"] = "1"
def reset_message_log():
"""Clear the in-memory chat log before and after every test."""
from dashboard.store import message_log
message_log.clear()
yield
message_log.clear()
@@ -127,6 +131,7 @@ def cleanup_event_loops():
"""Clean up any leftover event loops after each test."""
import asyncio
import warnings
yield
try:
try:
@@ -147,7 +152,9 @@ def cleanup_event_loops():
def client():
"""FastAPI test client with fresh app instance."""
from fastapi.testclient import TestClient
from dashboard.app import app
with TestClient(app) as c:
yield c
@@ -157,7 +164,8 @@ def db_connection():
"""Provide a fresh in-memory SQLite connection for tests."""
conn = sqlite3.connect(":memory:")
conn.row_factory = sqlite3.Row
conn.executescript("""
conn.executescript(
"""
CREATE TABLE IF NOT EXISTS agents (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
@@ -175,14 +183,13 @@ def db_connection():
created_at TEXT NOT NULL,
completed_at TEXT
);
""")
"""
)
conn.commit()
yield conn
conn.close()
@pytest.fixture
def mock_ollama_client():
"""Provide a mock Ollama client for unit tests."""
@@ -201,5 +208,3 @@ def mock_timmy_agent():
agent.run = MagicMock(return_value="Test response from Timmy")
agent.chat = MagicMock(return_value="Test chat response")
return agent