Skip to content
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

feat: add coverage output to py_pytest_main #492

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

alexeagle
Copy link
Member

If the user runs with coverage enabled, Bazel sets an environment variable pointing to the files to be instrumented. When that's present, attempt to import the coverage.py package, and use it to instrument and gather coverage, writing lcov directly. Note the user must provide the coverage.py package and it must be version 6.3 or greater, so that lcov reporting is built-in.

Fixes #353

Tested:

bazel test --collect_code_coverage --combined_report=lcov -s examples/pytest:pytest_test

If the user runs with coverage enabled, Bazel sets an environment variable pointing to the files to be instrumented.
When that's present, attempt to import the coverage.py package, and use it to instrument and gather coverage, writing lcov directly.
Note the user must provide the coverage.py package and it must be version 6.3 or greater, so that lcov reporting is built-in.

Fixes #353
@alexeagle alexeagle requested a review from thesayyn January 20, 2025 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: py_test does not work with bazel coverage
1 participant