File size: 945 Bytes
da8fcf1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Shared pytest fixtures for the ARCHITECT / Rhodawk test suite."""

from __future__ import annotations

import os
import sys
import tempfile
from pathlib import Path

import pytest

# Make the repo root importable regardless of pytest invocation directory.
ROOT = Path(__file__).resolve().parent.parent
if str(ROOT) not in sys.path:
    sys.path.insert(0, str(ROOT))


@pytest.fixture
def tmp_data_dir(monkeypatch):
    """Redirect /data writes into an isolated temp dir for the test."""
    d = Path(tempfile.mkdtemp(prefix="architect-test-"))
    monkeypatch.setenv("RHODAWK_DATA_DIR", str(d))
    monkeypatch.setenv("ARCHITECT_SKILLS_DIR", str(d / "skills"))
    (d / "skills").mkdir(parents=True, exist_ok=True)
    yield d


@pytest.fixture
def fresh_budget(monkeypatch):
    """Reset the model-router budget between tests."""
    from architect import model_router
    model_router.reset_budget(hard_cap_usd=10.0)
    yield model_router