Skip to content

Generate standard code coverage report data file in python:test task #290

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 1 commit into from
Jun 13, 2024
Merged

Generate standard code coverage report data file in python:test task #290

merged 1 commit into from
Jun 13, 2024

Conversation

per1234
Copy link
Collaborator

@per1234 per1234 commented Jun 13, 2024

The coverage run command used to run the Python unit tests generates a .coverage data file. This file can not be consumed directly by the "codecov/codecov-action" GitHub Actions action that uploads the coverage data to Codecov. A separate coverage xml command must be used to generate the appropriate file.

Previously this coverage xml command was ran directly in the test runner GitHub Actions workflow. However, the file is also required by contributors running tests on their local machines in some cases (e.g., displaying coverage in the VS Code editor via the popular "Coverage Gutters" extension, which does not support the .coverage file). For this reason, it is best to move the coverage xml command invocation to the taskfile. The time required to generate the file is insignificant so it is added to the python:test task rather than adding a separate task the contributor would be required to run after the python:test task.

The `coverage run` command used to run the Python unit tests generates a `.coverage` data file. This file can not be
consumed directly by the "codecov/codecov-action" GitHub Actions action that uploads the coverage data to Codecov. A
separate `coverage xml` command must be used to generate the appropriate file.

Previously this `coverage xml` command was ran directly in the test runner GitHub Actions workflow. However, the file is
also required by contributors running tests on their local machines in some cases (e.g., displaying coverage in the VS
Code editor via the popular "Coverage Gutters" extension, which does not support the `.coverage` file). For this reason,
it is best to move the `coverage xml` command invocation to the taskfile. The time required to generate the file is
insignificant so it is added to the `python:test` task rather than adding a separate task the contributor would be
required to run after the `python:test` task.
@per1234 per1234 added type: enhancement Proposed improvement topic: infrastructure Related to project infrastructure labels Jun 13, 2024
@per1234 per1234 self-assigned this Jun 13, 2024
@per1234 per1234 merged commit 9cbdcb8 into arduino:main Jun 13, 2024
28 of 29 checks passed
@per1234 per1234 deleted the coverage-task branch June 13, 2024 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant