fix: support harness codex model override
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
@@ -321,6 +322,47 @@ class ExecuteRunnerSafetyTests(unittest.TestCase):
|
||||
with patch.object(execute.shutil, "which", side_effect=fake_which):
|
||||
self.assertEqual(execute.StepExecutor._codex_command(), "C:/tools/codex.cmd")
|
||||
|
||||
def test_codex_exec_command_uses_model_env_override(self):
|
||||
execute = load_execute()
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
write_phase(root)
|
||||
executor = make_executor(execute, root)
|
||||
|
||||
with patch.object(executor, "_codex_command", return_value="codex.cmd"):
|
||||
with patch.dict(os.environ, {"HARNESS_CODEX_MODEL": "gpt-5"}):
|
||||
self.assertEqual(
|
||||
executor._codex_exec_command(),
|
||||
[
|
||||
"codex.cmd",
|
||||
"exec",
|
||||
"-m",
|
||||
"gpt-5",
|
||||
"--dangerously-bypass-approvals-and-sandbox",
|
||||
"--json",
|
||||
"-",
|
||||
],
|
||||
)
|
||||
|
||||
def test_configure_output_encoding_sets_utf8_replace(self):
|
||||
execute = load_execute()
|
||||
|
||||
class Stream:
|
||||
def __init__(self):
|
||||
self.calls = []
|
||||
|
||||
def reconfigure(self, **kwargs):
|
||||
self.calls.append(kwargs)
|
||||
|
||||
stdout = Stream()
|
||||
stderr = Stream()
|
||||
with patch.object(execute.sys, "stdout", stdout):
|
||||
with patch.object(execute.sys, "stderr", stderr):
|
||||
execute.configure_output_encoding()
|
||||
|
||||
self.assertEqual(stdout.calls, [{"encoding": "utf-8", "errors": "replace"}])
|
||||
self.assertEqual(stderr.calls, [{"encoding": "utf-8", "errors": "replace"}])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user