tests: write the offered-models list beside every models table fixture
Adds an offered(data_dir, text) helper, called from Core.table() and from each direct models.md write in the store; pops CLAUDE_CODE_ENTRYPOINT in the test env. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3a349a3859
commit
8c4fdf944e
2 files changed
+24
-2
No files matched your search
@@ -8,6 +8,7 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
@@ -24,6 +25,15 @@ HOST = "| sonnet | Anthropic | anthropic | host subagent `sonnet` | ordinary | p
|
||||
FALL = "Fallback order: routine: go/qwen-flash; ordinary: sonnet; hard: zai/glm-5.\n"
|
||||
|
||||
|
||||
def offered(data_dir, text):
|
||||
"""The offered-models list for the current harness, written beside models.md: pick refuses without it."""
|
||||
path = os.path.join(data_dir, "offered", "unknown.txt")
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
f.write("listed %s by harness unknown\n%s" % (time.strftime("%Y-%m-%dT%H:%M:%S"), text))
|
||||
return path
|
||||
|
||||
|
||||
def tree():
|
||||
out = hashlib.sha1()
|
||||
for p in sorted(glob.glob(os.path.join(REPO, "sisi", "*")) + glob.glob(os.path.join(REPO, "canon", "*"))):
|
||||
@@ -46,7 +56,7 @@ class ModelsResearch(unittest.TestCase):
|
||||
self.env = dict(os.environ, HOME=self.tmp, SISI_DATA=self.data,
|
||||
SISI_STATE=os.path.join(self.tmp, "state"), SISI_LIB=os.path.join(self.tmp, "lib"),
|
||||
CLAUDE_CONFIG_DIR=os.path.join(self.tmp, "claude"))
|
||||
for name in ("SISI_SESSION_ID", "CLAUDE_ENV_FILE", "XDG_DATA_HOME", "XDG_STATE_HOME", "CODEX_HOME"):
|
||||
for name in ("SISI_SESSION_ID", "CLAUDE_ENV_FILE", "XDG_DATA_HOME", "XDG_STATE_HOME", "CODEX_HOME", "CLAUDE_CODE_ENTRYPOINT"):
|
||||
self.env.pop(name, None)
|
||||
subprocess.run(["git", "init", "-q", self.data], check=True, capture_output=True, stdin=subprocess.DEVNULL)
|
||||
|
||||
@@ -186,6 +196,7 @@ class ModelsResearch(unittest.TestCase):
|
||||
os.makedirs(self.data, exist_ok=True)
|
||||
with open(os.path.join(self.data, "models.md"), "w", encoding="utf-8") as f:
|
||||
f.write(self.BUSY)
|
||||
offered(self.data, self.BUSY)
|
||||
use = self.in_process(models.plan_use, self.BUSY)[0]
|
||||
self.assertEqual((use["plan a"]["5h"], use["plan a"]["week"]), (0.0, 0.125))
|
||||
out = self.in_process(models.run, [])[1]
|
||||
|
||||
Reference in new issue
Block a user