From f93a13bfc2cbf7c2532606789ef648173f9bee1d Mon Sep 17 00:00:00 2001 From: "marcin p. joachimiak" <4625870+realmarcin@users.noreply.github.com> Date: Mon, 25 May 2026 19:22:11 -0700 Subject: [PATCH] Add pytest CI workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #71 added 43 unit tests across 4 files locking in idempotency, header validation, and other pipeline contracts — but none of them run in CI. validate-strict.yaml only checks per-record schema validity; it can't catch a regression that, say, breaks grounded_keys propagation in ground_causal_nodes.py or removes self-suppression from audit_writers.py. This workflow mirrors validate-strict.yaml's shape: - Triggers on PRs and pushes-to-main that touch scripts/**, src/traitmech/**, tests/**, pyproject.toml, or this workflow. - Uses astral-sh/setup-uv@v3 + Python 3.12 + uv sync --extra dev (pytest is in the dev extra per pyproject.toml). - Runs uv run pytest tests/ with -v --tb=short for readable failures in the GitHub Actions log. Verified locally: - python3 -c "import yaml; yaml.safe_load(open(...))" → yaml ok - uv run pytest tests/ → 56 passed Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/pytest.yaml | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/pytest.yaml diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml new file mode 100644 index 0000000..39c4f32 --- /dev/null +++ b/.github/workflows/pytest.yaml @@ -0,0 +1,38 @@ +name: pytest + +on: + pull_request: + paths: + - "scripts/**" + - "src/traitmech/**" + - "tests/**" + - "pyproject.toml" + - ".github/workflows/pytest.yaml" + push: + branches: [main] + paths: + - "scripts/**" + - "src/traitmech/**" + - "tests/**" + - "pyproject.toml" + - ".github/workflows/pytest.yaml" + workflow_dispatch: + +jobs: + pytest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + + - name: Set up Python + run: uv python install 3.12 + + - name: Install dependencies + run: uv sync --extra dev + + - name: Run pytest + run: uv run pytest tests/ -v --tb=short