Add pytest CI workflow#79
Merged
Merged
Conversation
#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) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a GitHub Actions workflow to run the repository’s Python unit tests in CI so that the existing tests/ suite is enforced on pull requests and main-branch pushes (complementing the existing schema/validation workflows).
Changes:
- Introduces a new
.github/workflows/pytest.yamlworkflow triggered on PRs and pushes tomainwith path filters. - Uses
astral-sh/setup-uv@v3+ Python 3.12 and installs dev extras (uv sync --extra dev) before runningpytest.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#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.yamlonly checks per-record schema validity; it can't catch a regression that, say, breaksgrounded_keyspropagation inground_causal_nodes.pyor removes self-suppression fromaudit_writers.py.This adds
.github/workflows/pytest.yamlmirroringvalidate-strict.yaml's shape.Behavior
pull_requestandpushtomain(path-filtered), plusworkflow_dispatch.scripts/**,src/traitmech/**,tests/**,pyproject.toml, the workflow file itself.ubuntu-latest, Python 3.12 viaastral-sh/setup-uv@v3.uv sync --extra dev(pytest is in thedevextra perpyproject.toml).uv run pytest tests/ -v --tb=shortfor readable failures in the run page.Verified locally
Test plan
.github/workflows/pytest.yaml, which is in its own path filter)🤖 Generated with Claude Code