Skip to content

Official Codebase of 3DCodeVerse

Python

tests: the per-process cost log is a temp file under test, never ~/.cache/codeverse3d/cost

gaoypeng008d12968662
diff --git a/harness/tests/conftest.py b/harness/tests/conftest.py
index ff4bdf4e..8214d8c2 100644
--- a/harness/tests/conftest.py
+++ b/harness/tests/conftest.py
@@ -23,6 +23,16 @@ def _fresh_settings():
get_settings.cache_clear()
[email protected](autouse=True)
+def _process_ledger(tmp_path_factory, monkeypatch):
+ """A metered call made outside any run ledger lands in the per-process log — under test, a
+ temp file, never the user's ``~/.cache/codeverse3d/cost/`` (fake judges bill a ledger row per
+ verdict, as a real judge's model does)."""
+ from codeverse3d.cost import ledger
+
+ monkeypatch.setattr(ledger, "_fallback", ledger.CostLedger(tmp_path_factory.mktemp("cost") / "process.jsonl"))
+
+
@pytest.fixture
def switch(monkeypatch):
"""``switch("C3D_X", "off")`` sets (``None``: unsets) one variable and drops the cached