chore: add scripts/dev/test.sh — chunked FIFO local test wrapper (~1.75x faster)#2719
chore: add scripts/dev/test.sh — chunked FIFO local test wrapper (~1.75x faster)#2719LahkLeKey wants to merge 2 commits into
Conversation
feat: add scripts/dev/test.sh — chunked FIFO local test wrapper (~1.75x faster)
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a local “fast test” wrapper to run pytest in bounded-size chunks using pytest-xdist, and updates pytest defaults to run in parallel by default.
Changes:
- Added
scripts/dev/test.shto collect node IDs once and execute them in fixed-size FIFO chunks with resume/reset support. - Added
pytest-xdistto test dependencies. - Enabled xdist parallel execution by default via
pyproject.tomlpytestaddopts.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| scripts/dev/test.sh | New chunked pytest runner with cursor-based resume/reset and xdist execution per chunk |
| pyproject.toml | Adds pytest-xdist and enables -n auto / --dist=worksteal in default pytest options |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
========================================================================================== short test summary info =========================================================================================== |
|
Visual feedback kinda meh during runtime, looking into making some dx tools prettier and test runtimes faster. looping in @mnriem incase you want to provide early feedback |
|
This was fine, rip my overage. @mnriem ready for review please trigger a fresh copilot |
| "--strict-markers", | ||
| "--tb=short", | ||
| "-n=auto", | ||
| "--dist=worksteal", | ||
| ] |
| "-v", | ||
| "--strict-markers", | ||
| "--tb=short", | ||
| "-n=auto", |
| mapfile -t NODES < <( | ||
| uv run pytest -o addopts= --collect-only -q "${PASSTHROUGH[@]}" \ | ||
| 2>/dev/null | grep -E '::' || true | ||
| ) |
| PYTEST_FLAGS=(-o addopts= -n auto --dist=load --tb=short) | ||
| (( BENCH )) && PYTEST_FLAGS+=(-q) || PYTEST_FLAGS+=(--no-header -q) | ||
|
|
||
| if ! uv run pytest "${PYTEST_FLAGS[@]}" "${NODES[@]:i:CHUNK_SIZE}"; then |
| if (( RESUME )) && [[ -f "$CURSOR_FILE" ]]; then | ||
| START="$(cat "$CURSOR_FILE")" | ||
| echo "[fast-test] resuming from chunk cursor: test #$START" | ||
| fi |
mnriem
left a comment
There was a problem hiding this comment.
Please address Copilot feedback
Description
Adds a single-file local DX wrapper,
scripts/dev/test.sh, that runs the existing pytest suite faster on developer machines without touching production code or CI.What it does
pytest --collect-only -q, then dispatches them in fixed-size chunks (default 200) throughpytest-xdistwith-n auto --dist=load..pytest_cache/fast-test-cursorafter every successful chunk, so a crash orCtrl-Ccan be resumed exactly where it left off with--resume.--chunk-size N,--reset,--bench, and--pass-through to pytest.Why this shape
--dist=load.uv run pytestentrypoint.Measured impact (local, Windows + Git Bash, 16-core)
uv run pytest(serial)bash scripts/dev/test.sh --bench~1.75x speedup end-to-end with no production source changes.
Testing
uv run specify --helpuv sync && uv run pytestAdditional validation:
bash scripts/dev/test.sh --bench→ 1m 29.85s wallclock.--resumecontinued from exactly that point with only the remaining tests executed.--resetclears the cursor file;--chunk-sizeand--pass-through both exercised.AI Disclosure
GitHub Copilot (Claude) assisted with drafting
scripts/dev/test.sh, iterating on the chunked-FIFO dispatch design, and producing the benchmark comparison. All design decisions, validation runs, and the final wrapper shape were reviewed and accepted by the author.