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
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,29 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-path: pyproject.toml
- name: Install dev dependencies
run: python -m pip install --upgrade pip && pip install -e ".[dev]"
- name: Ruff
run: ruff check .
- name: Mypy
run: mypy

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: pyproject.toml
- name: Install dev dependencies
run: python -m pip install --upgrade pip && pip install -e ".[dev]"
- name: Pytest
run: pytest
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dev = [
"ruff>=0.6",
"mypy>=1.10",
"types-jsonschema",
"pytest>=7.0",
]

[project.scripts]
Expand All @@ -34,3 +35,7 @@ target-version = "py39"
files = ["src"]
disallow_untyped_defs = true
disallow_incomplete_defs = true

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-ra"
30 changes: 30 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Shared pytest fixtures.

OPENHACK_ROOT is pinned to the repo root so ``paths.root()`` resolves
deterministically regardless of where pytest is invoked from. Modules under
test reach for ``root() / "agents" / "experts"`` and ``root() / "config"``,
so the real on-disk workspace is the simplest fixture.
"""

from __future__ import annotations

from pathlib import Path

import pytest

from openhack.paths import ALL_RUN_DIRS

REPO_ROOT = Path(__file__).resolve().parent.parent


@pytest.fixture(autouse=True)
def _pin_openhack_root(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("OPENHACK_ROOT", str(REPO_ROOT))


@pytest.fixture()
def run_dir(tmp_path: Path) -> Path:
"""A scratch run directory with the standard subdirs created."""
for name in ALL_RUN_DIRS:
(tmp_path / name).mkdir(parents=True, exist_ok=True)
return tmp_path
Loading
Loading