test: split slow tests, cache CI deps, add pre-push gate#83
Merged
Conversation
Accelerate the test suite locally and on GitHub Actions without removing coverage. - Tag the 109 heaviest end-to-end tests `@pytest.mark.slow` via a central registry in tests/conftest.py (derived from `pytest --durations`). The fast path (`-m "not slow"`) runs 1618 tests in ~48s vs ~113s for the full suite; nothing is deleted and the full suite still runs everything. - CI (ci.yml): enable setup-uv dependency caching (torch & friends stop re-downloading every run), switch installs to `uv sync`, and split into a fast required PR gate plus a nightly/on-demand `test-full` job that runs the whole suite. release.yml runs the fast gate as a pre-publish check. - Add a pre-commit pre-push hook (.pre-commit-config.yaml) that runs the fast suite and blocks the push on failure; document install in README. - Register the `slow` marker and `--durations=15`; add `pre-commit` dev dep. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Context
The pytest suite has grown to 1,727 tests across 151 files and takes ~113 s locally with
-n auto; on GitHub it's worse because no dependency caching exists, so every run reinstalls all deps including the CPU-only torch wheel. There was also no way to skip heavy tests (no markers) and no enforcement of running tests before pushing.This PR accelerates the suite locally and in CI without removing any test coverage, and adds a local pre-push gate.
What changed
Slow/fast split (coverage preserved)
tests/conftest.pycentral registry tags the 109 heaviest end-to-end tests@pytest.mark.slow(derived frompytest --durations). No tests deleted — the full suite still runs everything.pyproject.toml: registered theslowmarker +addopts=["--durations=15"].-m "not slow")CI acceleration (
ci.yml,release.yml)setup-uvenable-cache(existing pinned action SHA kept) — torch & friends stop re-downloading every run.uv pip install --system→uv sync(no more double-install withuv run).-m "not slow") + newtest-fulljob running the whole suite nightly (cron) and onworkflow_dispatch.release.ymlnow runs the fast gate as a pre-publish check instead of the full suite.Force tests before push
.pre-commit-config.yaml:pre-pushhook runsuv run pytest -m "not slow" -n autoand blocks the push on failure; commit-stageruff+black --check. Addedpre-committo dev deps.uv run pre-commit install --hook-type pre-push --hook-type pre-commit.Notes for reviewers
slowset lives in one reviewable place (tests/conftest.py) and is matched by node id (file / class / test granularity); refresh it from--durationsas the suite evolves. New slow tests can also just use@pytest.mark.slow.uv.lockincludes a pre-existing lockfile refresh that was already in the working tree (Dependabot transitive bumps) plus the newpre-commitdependency tree.Verification
ruff check+black --checkclean on new files; all workflow/precommit YAML parses.🤖 Generated with Claude Code