flow2 / tests /unit /test_cli_scripts.py
AndrianBalanescu
feat(novelty): multi-category art factory with dynamic anti-repetition engine and zero-gpu exhaustion loop
4237e7a
Raw History Blame Contribute Delete
1.57 kB
"""Unit tests for CLI runner scripts (autonomous_zerogpu_loop and ibrowse_qa_audit).
"""
import sys
from pathlib import Path
import pytest
PROJECT_ROOT = Path(__file__).resolve().parent.parent.parent
MOLDOVAN_SCRIPTS = PROJECT_ROOT / "moldovan-qwen" / "scripts"
if str(MOLDOVAN_SCRIPTS) not in sys.path:
sys.path.insert(0, str(MOLDOVAN_SCRIPTS))
def test_zerogpu_loop_engine_dry_run():
"""Verify ZeroGPULoopEngine runs safely in dry-run mode without network/GPU cost."""
from autonomous_zerogpu_loop import ZeroGPULoopEngine
engine = ZeroGPULoopEngine(target_minutes=40.0, dry_run=True)
res = engine.run_single_batch()
assert res.get("dry_run") is True
assert "steps" in res
assert len(res["steps"]) >= 3
assert "category" in res
assert "genre" in res
assert "persona" in res
for step in res["steps"]:
assert step["status"] == "ok"
def test_zerogpu_loop_engine_status():
"""Verify status inspection returns valid budget ledger structure."""
from autonomous_zerogpu_loop import ZeroGPULoopEngine
engine = ZeroGPULoopEngine(target_minutes=40.0, dry_run=True)
status = engine.get_status()
assert "date" in status
assert "target_minutes" in status
assert status["target_minutes"] == 40.0
def test_ibrowse_auditor_init():
"""Verify IBrowseQAAuditor initialization and host selection."""
from ibrowse_qa_audit import IBrowseQAAuditor
auditor = IBrowseQAAuditor(token="test_token")
assert auditor.token == "test_token"
assert auditor.base_url.startswith("http")