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
11 changes: 8 additions & 3 deletions .github/workflows/quality-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ jobs:
run: uv run mypy src/nasde_toolkit/

test:
name: Unit tests (pytest)
runs-on: ubuntu-latest
name: Unit tests (pytest) — ${{ matrix.os }} / py${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python: ["3.12", "3.13"]
steps:
- uses: actions/checkout@v4

Expand All @@ -67,7 +72,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: ${{ matrix.python }}

- name: Install dependencies
run: uv sync --extra dev
Expand Down
10 changes: 5 additions & 5 deletions tests/test_evaluator_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,15 @@ def test_codex_backend_validate_auth_succeeds_with_chatgpt_oauth(
codex_home.mkdir()
auth_file = codex_home / "auth.json"
auth_file.write_text('{"auth_mode": "chatgpt", "tokens": {"access_token": "tok"}}')
monkeypatch.setenv("HOME", str(tmp_path))
monkeypatch.setattr("pathlib.Path.home", lambda: tmp_path)
backend = CodexSubprocessBackend()
backend.validate_auth()


def test_codex_backend_validate_auth_fails_without_credentials(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
monkeypatch.delenv("OPENAI_API_KEY", raising=False)
monkeypatch.delenv("CODEX_API_KEY", raising=False)
monkeypatch.setenv("HOME", str(tmp_path))
monkeypatch.setattr("pathlib.Path.home", lambda: tmp_path)
backend = CodexSubprocessBackend()
with pytest.raises(SystemExit):
backend.validate_auth()
Expand Down Expand Up @@ -263,7 +263,7 @@ def test_codex_backend_env_strips_api_keys_when_oauth_present(
codex_home = tmp_path / ".codex"
codex_home.mkdir()
(codex_home / "auth.json").write_text('{"auth_mode": "chatgpt", "tokens": {"access_token": "tok"}}')
monkeypatch.setenv("HOME", str(tmp_path))
monkeypatch.setattr("pathlib.Path.home", lambda: tmp_path)
monkeypatch.setenv("CODEX_API_KEY", "sk-stale-key-from-dotenv")
monkeypatch.delenv("OPENAI_API_KEY", raising=False)

Expand All @@ -278,7 +278,7 @@ def test_codex_backend_env_promotes_codex_key_to_openai_key(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
) -> None:
monkeypatch.setenv("HOME", str(tmp_path))
monkeypatch.setattr("pathlib.Path.home", lambda: tmp_path)
monkeypatch.setenv("CODEX_API_KEY", "sk-codex-key")
monkeypatch.delenv("OPENAI_API_KEY", raising=False)

Expand All @@ -296,7 +296,7 @@ def test_codex_backend_env_preserves_openai_key_priority(
codex_home = tmp_path / ".codex"
codex_home.mkdir()
(codex_home / "auth.json").write_text('{"auth_mode": "chatgpt", "tokens": {"access_token": "tok"}}')
monkeypatch.setenv("HOME", str(tmp_path))
monkeypatch.setattr("pathlib.Path.home", lambda: tmp_path)
monkeypatch.setenv("OPENAI_API_KEY", "sk-explicit-openai-key")
monkeypatch.setenv("CODEX_API_KEY", "sk-stale-codex-key")

Expand Down
Loading