Skip to content

Commit 02d9ba6

Browse files
committed
fix(toolchain) Override coverage rc
1 parent 10d9ab9 commit 02d9ba6

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

python/private/stage2_bootstrap_template.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -323,29 +323,28 @@ def _maybe_collect_coverage(enable):
323323
relative_files = True
324324
source =
325325
\t{source}
326+
omit =
327+
# Pipes can't be read back later, which can cause coverage to
328+
# throw an error when trying to get its source code.
329+
/dev/fd/*
330+
# The mechanism for finding third-party packages in coverage-py
331+
# only works for installed packages, not for runfiles. e.g:
332+
#'$HOME/.local/lib/python3.10/site-packages',
333+
# '/usr/lib/python',
334+
# '/usr/lib/python3.10/site-packages',
335+
# '/usr/local/lib/python3.10/dist-packages'
336+
# see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
337+
*/external/*
326338
"""
327339
)
328340
try:
329341
cov = coverage.Coverage(
330-
config_file=rcfile_name,
342+
config_file=os.environ.get("COVERAGE_RCFILE", rcfile_name),
331343
branch=True,
332344
# NOTE: The messages arg controls what coverage prints to stdout/stderr,
333345
# which can interfere with the Bazel coverage command. Enabling message
334346
# output is only useful for debugging coverage support.
335347
messages=is_verbose_coverage(),
336-
omit=[
337-
# Pipes can't be read back later, which can cause coverage to
338-
# throw an error when trying to get its source code.
339-
"/dev/fd/*",
340-
# The mechanism for finding third-party packages in coverage-py
341-
# only works for installed packages, not for runfiles. e.g:
342-
#'$HOME/.local/lib/python3.10/site-packages',
343-
# '/usr/lib/python',
344-
# '/usr/lib/python3.10/site-packages',
345-
# '/usr/local/lib/python3.10/dist-packages'
346-
# see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
347-
"*/external/*",
348-
],
349348
)
350349
cov.start()
351350
try:

0 commit comments

Comments
 (0)