Skip to content

Commit

Permalink
fix: Exclude external directory when generating python report
Browse files Browse the repository at this point in the history
  • Loading branch information
ewianda committed Aug 21, 2024
1 parent 425dfb0 commit 498c33c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ A brief description of the categories of changes:
### Changed
* Nothing yet

### Fixed
* (rule) Omit third-party python packages from coverage reports
([#2136](https://github.com/bazelbuild/rules_python/issues/2136))

### Added
* Nothing yet

Expand Down
8 changes: 8 additions & 0 deletions python/private/stage2_bootstrap_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,14 @@ def _maybe_collect_coverage(enable):
# Pipes can't be read back later, which can cause coverage to
# throw an error when trying to get its source code.
"/dev/fd/*",
# The mechanism for finding third-party packages in coverage-py
# only works for installed packages, not for runfiles. e.g:
#'$HOME/.local/lib/python3.10/site-packages',
# '/usr/lib/python',
# '/usr/lib/python3.10/site-packages',
# '/usr/local/lib/python3.10/dist-packages'
# see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
"*/external/*",
],
)
cov.start()
Expand Down

0 comments on commit 498c33c

Please sign in to comment.