forked from Rockachopa/Timmy-time-dashboard
This commit is contained in:
@@ -53,6 +53,7 @@ async def test_model_fallback_chain():
|
||||
assert model == "nonexistent-model"
|
||||
|
||||
|
||||
@pytest.mark.ollama
|
||||
@pytest.mark.asyncio
|
||||
async def test_timmy_agent_with_available_model():
|
||||
"""Test that Timmy agent can be created with an available model."""
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
|
||||
def test_get_system_info_returns_dict():
|
||||
@@ -164,19 +163,36 @@ class TestGetOllamaModelExactMatch:
|
||||
class TestRunSelfTests:
|
||||
"""Tests for run_self_tests() — Timmy's self-verification tool."""
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_returns_dict_with_expected_keys(self):
|
||||
def test_returns_dict_with_expected_keys(self, monkeypatch, tmp_path):
|
||||
"""run_self_tests should return structured test results."""
|
||||
import subprocess
|
||||
|
||||
def mock_run(*args, **kwargs):
|
||||
return subprocess.CompletedProcess(
|
||||
args=args[0] if args else [],
|
||||
returncode=0,
|
||||
stdout="5 passed in 0.5s",
|
||||
stderr="",
|
||||
)
|
||||
|
||||
monkeypatch.setattr(subprocess, "run", mock_run)
|
||||
|
||||
# Create fake venv so check passes
|
||||
venv_python = tmp_path / ".venv" / "bin" / "python"
|
||||
venv_python.parent.mkdir(parents=True)
|
||||
venv_python.write_text("#!/bin/sh\necho mock")
|
||||
|
||||
from timmy.tools_intro import run_self_tests
|
||||
|
||||
result = run_self_tests(scope="tests/timmy/test_introspection.py")
|
||||
result = run_self_tests(scope="tests/timmy/test_introspection.py", _repo_root=str(tmp_path))
|
||||
assert isinstance(result, dict)
|
||||
assert "success" in result
|
||||
# Should have count keys when tests ran
|
||||
if result["success"] or "passed" in result:
|
||||
assert "passed" in result
|
||||
assert "failed" in result
|
||||
assert "total" in result
|
||||
assert result["success"] is True
|
||||
assert "passed" in result
|
||||
assert "failed" in result
|
||||
assert "total" in result
|
||||
assert result["passed"] == 5
|
||||
assert result["total"] == 5
|
||||
|
||||
def test_fast_scope_skips_integration(self, monkeypatch, tmp_path):
|
||||
"""Fast scope should exclude functional/e2e/integration dirs."""
|
||||
|
||||
Reference in New Issue
Block a user