Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/run_monthly_codex_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
import urllib.parse
import urllib.request

from service.model_router import route_model
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))

from service.model_router import route_model # noqa: E402


API_BASE = "https://api.github.com"
ROOT = Path(__file__).resolve().parents[1]
PROMPT_TEMPLATES = {
"monthly_snapshot_audit": ROOT / "prompts" / "monthly_crypto_snapshot_audit.md",
"long_horizon_signal_shadow": ROOT / "prompts" / "long_horizon_signal_shadow.md",
Expand Down
20 changes: 20 additions & 0 deletions tests/test_run_monthly_codex_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import os
import subprocess
import sys
import tempfile
import threading
import time
Expand Down Expand Up @@ -93,6 +94,25 @@ def _normalized_policy(policy: dict[str, object]) -> dict[str, object]:


class RunMonthlyCodexAuditTests(unittest.TestCase):
def test_script_entrypoint_can_import_service_from_repo_root(self) -> None:
repo_root = Path(__file__).resolve().parents[1]
env = dict(os.environ)
env.pop("PYTHONPATH", None)
env["ISSUE_NUMBER"] = ""

result = subprocess.run(
[sys.executable, "scripts/run_monthly_codex_audit.py"],
cwd=repo_root,
env=env,
capture_output=True,
text=True,
check=False,
)

self.assertEqual(result.returncode, 1)
self.assertIn("ISSUE_NUMBER must be provided as an integer", result.stderr)
self.assertNotIn("ModuleNotFoundError", result.stderr)

def test_parse_bool_accepts_common_true_values(self) -> None:
for value in ("1", "true", "TRUE", "yes", "on", True):
self.assertTrue(parse_bool(value))
Expand Down
Loading