Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ END_UNRELEASED_TEMPLATE
default to `true`.
* (pypi) The data files of a wheel (bin, includes, etc) are now always included
as a library's data dependencies.
* (coverage) When `configure_coverage_tool = True` is set but the bundled
`coverage.py` wheel set has no entry for the requested python version and
platform, a warning is now printed instead of silently producing an empty
coverage report.

{#v0-0-0-fixed}
### Fixed
Expand Down
10 changes: 9 additions & 1 deletion python/private/coverage_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,15 @@ def coverage_dep(name, python_version, platform, visibility):
url, sha256 = _coverage_deps.get(abi, {}).get(platform, (None, ""))

if url == None:
# Some wheels are not present for some builds, so let's silently ignore those.
# buildifier: disable=print
print((
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use logger.warn with an optional logger passed in.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also take a look how to pass that from the layers above. For bzlmod we'll have the module extension context, so it should be relatively easy. For macros for WORKSPACE we should pass in a mock context because we are executing it in a macro if I remember correctly.

"WARNING: rules_python's bundled coverage tool has no wheel for " +
"python_version={}, platform={}. `bazel coverage` will produce " +
"empty lcov for py_test targets in this configuration. Either " +
"pin python_version to a version in the bundled set (see " +
"python/private/coverage_deps.bzl), or configure coverage " +
"manually via py_runtime.coverage_tool. See docs/coverage.md."
).format(python_version, platform))
return None

maybe(
Expand Down