diff --git a/codex_exec_json_all_formats.jsonl b/tests/fixtures/codex_exec_json_all_formats.jsonl similarity index 100% rename from codex_exec_json_all_formats.jsonl rename to tests/fixtures/codex_exec_json_all_formats.jsonl diff --git a/tests/fixtures/codex_exec_json_all_formats.txt b/tests/fixtures/codex_exec_json_all_formats.txt new file mode 100644 index 0000000..c148524 --- /dev/null +++ b/tests/fixtures/codex_exec_json_all_formats.txt @@ -0,0 +1,32 @@ +stream error: Failed to load optional config file ~/.codex/local.toml (ENOENT); continuing with defaults +thread started +turn started +2. ✓ searched: python jsonlines parser handle unknown fields +stream error: Web search disabled by policy; returned cached results only +3. ▸ tool: github.search_issues +3. ✓ tool: github.search_issues +4. ▸ `pytest -q` +4. ✗ `pytest -q` (exit 1) +5. ✓ updated `src/compute_answer.py`, `tests/test_beta.py` +6. ▸ `pytest -q` +6. ✓ `pytest -q` +7. Root cause: compute_answer() returned 0. Updated logic to return 42 for the valid input path. Re-ran pytest to confirm all tests pass. +assistant: + I found the failing assertion in tests/test_beta.py and updated src/compute_answer.py to return the expected value (42). After the change, `pytest -q` reports 12 passed. +turn completed +turn started +9. ▸ `npm test` +9. ✗ `npm test` (exit 127) +10. ✓ warning: Command `npm` not found in PATH (exit 127). +turn failed: Aborted: required dependency `npm` is missing; cannot continue. +stream error: codex exec exited non-zero (1) after turn.failed +thread started +turn started +assistant: + Legacy schema example: hello (item_type=assistant_message). +2. ✓ `echo legacy` +turn completed +thread started +turn started +2. ✓ updated `README.md` +turn completed diff --git a/tests/test_exec_render.py b/tests/test_exec_render.py index fc1d2dc..98987e3 100644 --- a/tests/test_exec_render.py +++ b/tests/test_exec_render.py @@ -11,7 +11,10 @@ def _loads(lines: str) -> list[dict]: FIXTURE_PATH = Path(__file__).resolve().parent / "fixtures" / "codex.jsonl" ALL_FORMATS_FIXTURE_PATH = ( - Path(__file__).resolve().parent.parent / "codex_exec_json_all_formats.jsonl" + Path(__file__).resolve().parent / "fixtures" / "codex_exec_json_all_formats.jsonl" +) +ALL_FORMATS_GOLDEN_PATH = ( + Path(__file__).resolve().parent / "fixtures" / "codex_exec_json_all_formats.txt" ) SAMPLE_STREAM = """ @@ -91,6 +94,18 @@ def test_render_event_cli_all_formats_fixture() -> None: assert any("Legacy schema example" in line for line in out) +def test_render_event_cli_all_formats_golden() -> None: + events = _loads(ALL_FORMATS_FIXTURE_PATH.read_text(encoding="utf-8")) + last_turn = None + out: list[str] = [] + for evt in events: + last_turn, lines = render_event_cli(evt, last_turn) + out.extend(lines) + + expected = ALL_FORMATS_GOLDEN_PATH.read_text(encoding="utf-8").rstrip("\n") + assert "\n".join(out) == expected + + def test_progress_renderer_renders_progress_and_final() -> None: r = ExecProgressRenderer(max_actions=5) for evt in _loads(SAMPLE_STREAM):