Skip to content

Commit aecf6db

Browse files
committed
fix(toolchain) Override coverage rc
1 parent bb56a77 commit aecf6db

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
@@ -309,29 +309,28 @@ def _maybe_collect_coverage(enable):
309309
relative_files = True
310310
source =
311311
\t{source}
312+
omit =
313+
# Pipes can't be read back later, which can cause coverage to
314+
# throw an error when trying to get its source code.
315+
/dev/fd/*
316+
# The mechanism for finding third-party packages in coverage-py
317+
# only works for installed packages, not for runfiles. e.g:
318+
#'$HOME/.local/lib/python3.10/site-packages',
319+
# '/usr/lib/python',
320+
# '/usr/lib/python3.10/site-packages',
321+
# '/usr/local/lib/python3.10/dist-packages'
322+
# see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
323+
*/external/*
312324
"""
313325
)
314326
try:
315327
cov = coverage.Coverage(
316-
config_file=rcfile_name,
328+
config_file=os.environ.get("COVERAGE_RCFILE", rcfile_name),
317329
branch=True,
318330
# NOTE: The messages arg controls what coverage prints to stdout/stderr,
319331
# which can interfere with the Bazel coverage command. Enabling message
320332
# output is only useful for debugging coverage support.
321333
messages=is_verbose_coverage(),
322-
omit=[
323-
# Pipes can't be read back later, which can cause coverage to
324-
# throw an error when trying to get its source code.
325-
"/dev/fd/*",
326-
# The mechanism for finding third-party packages in coverage-py
327-
# only works for installed packages, not for runfiles. e.g:
328-
#'$HOME/.local/lib/python3.10/site-packages',
329-
# '/usr/lib/python',
330-
# '/usr/lib/python3.10/site-packages',
331-
# '/usr/local/lib/python3.10/dist-packages'
332-
# see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
333-
"*/external/*",
334-
],
335334
)
336335
cov.start()
337336
try:

0 commit comments

Comments
 (0)