File size: 1,567 Bytes
183493f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4237e7a
 
 
 
183493f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""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")