From 27e87ea9128fd4cc09dab2b4b34e432e03ceb446 Mon Sep 17 00:00:00 2001 From: Elvis Wianda Date: Mon, 26 Aug 2024 18:49:46 -0700 Subject: [PATCH] fix(toolchain) Override coverage rc --- python/private/stage2_bootstrap_template.py | 27 ++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/python/private/stage2_bootstrap_template.py b/python/private/stage2_bootstrap_template.py index d2c7497795..103cc4c687 100644 --- a/python/private/stage2_bootstrap_template.py +++ b/python/private/stage2_bootstrap_template.py @@ -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: