-
Notifications
You must be signed in to change notification settings - Fork 5k
Add test coverage to CI workflow #2690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ coverage.xml | |
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
coverage_report.html | ||
|
||
# Translations | ||
*.mo | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,9 @@ contact [[email protected]](mailto:[email protected]) with any additio | |
- [Running unit tests](#running-unit-tests) | ||
- [Running E2E tests](#running-e2e-tests) | ||
- [Code style](#code-style) | ||
- [Adding new azd environment variables](#adding-new-azd-environment-variables) | ||
- [Adding new UI strings](#adding-new-ui-strings) | ||
- [Adding new features](#adding-new-features) | ||
- [Adding new azd environment variables](#adding-new-azd-environment-variables) | ||
- [Adding new UI strings](#adding-new-ui-strings) | ||
|
||
## Submitting a Pull Request (PR) | ||
|
||
|
@@ -62,10 +63,18 @@ Run the tests: | |
python -m pytest | ||
``` | ||
|
||
Check the coverage report to make sure your changes are covered. | ||
If test snapshots need updating (and the changes are expected), you can update them by running: | ||
|
||
```shell | ||
python -m pytest --cov | ||
python -m pytest --snapshot-update | ||
``` | ||
|
||
Once tests are passing, generate a coverage report to make sure your changes are covered: | ||
|
||
```shell | ||
pytest --cov --cov-report=xml && \ | ||
diff-cover coverage.xml --format html:coverage_report.html && \ | ||
open coverage_report.html | ||
``` | ||
|
||
## Running E2E tests | ||
|
@@ -118,7 +127,15 @@ python -m black <path-to-file> | |
|
||
If you followed the steps above to install the pre-commit hooks, then you can just wait for those hooks to run `ruff` and `black` for you. | ||
|
||
## Adding new azd environment variables | ||
## Adding new features | ||
|
||
We recommend using GitHub Copilot Agent mode when adding new features, | ||
as this project includes [.github/copilot-instructions.md](.github/copilot-instructions.md) file | ||
that instructs Copilot on how to generate code for common code changes. | ||
|
||
If you are not using Copilot Agent mode, consult both that file and suggestions below. | ||
|
||
### Adding new azd environment variables | ||
|
||
When adding new azd environment variables, please remember to update: | ||
|
||
|
@@ -128,7 +145,7 @@ When adding new azd environment variables, please remember to update: | |
1. [ADO pipeline](.azdo/pipelines/azure-dev.yml). | ||
1. [Github workflows](.github/workflows/azure-dev.yml) | ||
|
||
## Adding new UI strings | ||
### Adding new UI strings | ||
|
||
When adding new UI strings, please remember to update all translations. | ||
For any translations that you generate with an AI tool, | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ pytest-snapshot | |
pre-commit | ||
pip-tools | ||
mypy==1.14.1 | ||
diff_cover | ||
axe-playwright-python |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The minimum coverage requirement is inconsistent. The pytest command still uses
--cov-fail-under=89
while the diff-cover step enforces 90% coverage. This could cause confusion and inconsistent behavior.Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main branch doesnt yet have 90% coverage. It will in the upcoming multimodal PR. The two numbers can be different since one measures the total coverage and the other measures the coverage just of changed lines.