Skip to content

Commit 316ab80

Browse files
committed
fix(toolchain) Override coverage rc
1 parent 6361057 commit 316ab80

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
@@ -350,29 +350,28 @@ def _maybe_collect_coverage(enable):
350350
rcfile.write(
351351
"""[run]
352352
relative_files = True
353+
omit =
354+
# Pipes can't be read back later, which can cause coverage to
355+
# throw an error when trying to get its source code.
356+
/dev/fd/*
357+
# The mechanism for finding third-party packages in coverage-py
358+
# only works for installed packages, not for runfiles. e.g:
359+
#'$HOME/.local/lib/python3.10/site-packages',
360+
# '/usr/lib/python',
361+
# '/usr/lib/python3.10/site-packages',
362+
# '/usr/local/lib/python3.10/dist-packages'
363+
# see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
364+
*/external/*
353365
"""
354366
)
355367
try:
356368
cov = coverage.Coverage(
357-
config_file=rcfile_name,
369+
config_file=os.environ.get("COVERAGE_RCFILE", rcfile_name),
358370
branch=True,
359371
# NOTE: The messages arg controls what coverage prints to stdout/stderr,
360372
# which can interfere with the Bazel coverage command. Enabling message
361373
# output is only useful for debugging coverage support.
362374
messages=is_verbose_coverage(),
363-
omit=[
364-
# Pipes can't be read back later, which can cause coverage to
365-
# throw an error when trying to get its source code.
366-
"/dev/fd/*",
367-
# The mechanism for finding third-party packages in coverage-py
368-
# only works for installed packages, not for runfiles. e.g:
369-
#'$HOME/.local/lib/python3.10/site-packages',
370-
# '/usr/lib/python',
371-
# '/usr/lib/python3.10/site-packages',
372-
# '/usr/local/lib/python3.10/dist-packages'
373-
# see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
374-
"*/external/*",
375-
],
376375
)
377376
cov.start()
378377
try:

0 commit comments

Comments
 (0)