PYTHON-5753 Add just recipes for running coverage tests locally#2727
Merged
aclark4life merged 4 commits intomongodb:masterfrom Mar 12, 2026
Merged
PYTHON-5753 Add just recipes for running coverage tests locally#2727aclark4life merged 4 commits intomongodb:masterfrom
aclark4life merged 4 commits intomongodb:masterfrom
Conversation
aclark4life
commented
Mar 11, 2026
justfile
Outdated
| uv run --active --extra test --group coverage python -m coverage run -m pytest {{args}} | ||
| uv run --active --group coverage python -m coverage report | ||
| else | ||
| # Otherwise use the standard Evergreen workflow |
Contributor
Author
There was a problem hiding this comment.
I'm going to make a follow up ticket PYTHON-5754 makes setup-testsrun-tests support USE_ACTIVE_VENV so this could potentially wait for that to be done and then we can remove this conditional statement.
NoahStapp
requested changes
Mar 11, 2026
CONTRIBUTING.md
Outdated
| and the `<class_name>` to test a full module. For example: | ||
| `just test test/test_change_stream.py::TestUnifiedChangeStreamsErrors::test_change_stream_errors_on_ElectionInProgress`. | ||
| - Use the `-k` argument to select tests by pattern. | ||
| - Run `just test-coverage` to run tests with coverage and display a report. Use `just coverage-html` to generate an HTML report in `htmlcov/index.html`. |
Contributor
There was a problem hiding this comment.
Does just coverage-html require just test-coverage to be run first? We should make that clear if so.
3881940 to
a80d0ad
Compare
There was a problem hiding this comment.
Pull request overview
Adds local developer ergonomics for running the PyMongo test suite with coverage via just, and documents the new commands for contributors.
Changes:
- Introduces a
just test-coveragerecipe with support for running in an active venv (USE_ACTIVE_VENV) or via the Evergreen-style setup/run workflow. - Adds
justrecipes to generate coverage reports in terminal, HTML, and XML formats. - Updates contributor docs to mention the new coverage recipes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
justfile |
Adds test-coverage plus coverage-report/html/xml recipes for local coverage workflows. |
CONTRIBUTING.md |
Documents just test-coverage and just coverage-html for contributors. |
justfile
Outdated
| # Otherwise use the standard Evergreen workflow | ||
| just setup-tests --cov | ||
| just run-tests {{args}} | ||
| just coverage-report |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
NoahStapp
approved these changes
Mar 12, 2026
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.
PYTHON-5753
Changes in this PR
Add just recipes for running coverage tests locally
Test Plan
Checklist
Checklist for Author
Checklist for Reviewer