Skip to content

Commit

Permalink
fix(toolchain) Override coverage rc
Browse files Browse the repository at this point in the history
  • Loading branch information
ewianda committed Nov 22, 2024
1 parent 2abca35 commit 27e87ea
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions python/private/stage2_bootstrap_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,29 +284,28 @@ def _maybe_collect_coverage(enable):
rcfile.write(
"""[run]
relative_files = True
omit =
# 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/*
"""
)
try:
cov = coverage.Coverage(
config_file=rcfile_name,
config_file=os.environ.get("COVERAGE_RCFILE", rcfile_name),
branch=True,
# NOTE: The messages arg controls what coverage prints to stdout/stderr,
# which can interfere with the Bazel coverage command. Enabling message
# output is only useful for debugging coverage support.
messages=is_verbose_coverage(),
omit=[
# 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()
try:
Expand Down

0 comments on commit 27e87ea

Please sign in to comment.