Improve Coverage Accuracy and Speed Up Tests#144
Open
Darshan808 wants to merge 10 commits into
Open
Conversation
3759964 to
3c36728
Compare
Member
Author
|
Some progress here. |
Member
Author
|
The version mismatch test started to act flaky. |
Member
Author
|
Ah, Test is being flaky as it is hitting rate limits when trying to pull |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to (1) make CI coverage reporting accurate for code exercised via subprocess-driven CLI tests and (2) reduce test runtime by moving expensive template setup/build work into shared pytest fixtures.
Changes:
- Enable subprocess-aware coverage collection via
coverage.pyconfig (patch = ["subprocess"]) and re-enable the CI coverage gate. - Speed up tests by introducing session-scoped fixtures that render/build the template once and provide per-test copies.
- Reduce watch-test flakiness by replacing fixed sleeps with polling, and mark template tests as
slow.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_tpl.py |
Refactors template/watch tests to use shared fixtures, adds polling for watch tests, and marks all tests as slow. |
tests/conftest.py |
Adds session-scoped fixtures to render/build/install the template once and provide isolated per-test copies; sets COVERAGE_FILE. |
pyproject.toml |
Updates test dependencies and adds coverage + pytest marker configuration to support subprocess coverage and slow marker. |
jupyter_builder/debug_log_file_mixin.py |
Fixes empty-path directory handling for debug logs and broadens best-effort unlink suppression for Windows. |
.github/workflows/builder-tests.yml |
Re-enables the coverage job to enforce a minimum coverage threshold in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.
Fixes #95
Description
Our coverage number was misleading. It reported ~16%, but that was because almost all of the real testing happens through
subprocess.run(["jupyter-builder", ...])calls, and coverage does not track subprocesses by default. The code was being tested, just not measured.coverage.py7.10'spatch = ["subprocess"], so thejupyter-builderandjlpmCLIs collect coverage themselves andpytest-covmerges everything into a single report.Result: Coverage increased from ~16% → ~70% without changing any tests.
Faster tests
jlpm install, and TypeScript build into session-scoped fixtures (tests/conftest.py). Each test now gets a cheap local copy instead of repeating the expensive setup.test_tpl.pyasslow, sopytest -m "not slow"provides a much faster local test run.