@@ -284,29 +284,28 @@ def _maybe_collect_coverage(enable):
284284 rcfile .write (
285285 """[run]
286286relative_files = True
287+ omit =
288+ # Pipes can't be read back later, which can cause coverage to
289+ # throw an error when trying to get its source code.
290+ /dev/fd/*
291+ # The mechanism for finding third-party packages in coverage-py
292+ # only works for installed packages, not for runfiles. e.g:
293+ #'$HOME/.local/lib/python3.10/site-packages',
294+ # '/usr/lib/python',
295+ # '/usr/lib/python3.10/site-packages',
296+ # '/usr/local/lib/python3.10/dist-packages'
297+ # see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
298+ */external/*
287299"""
288300 )
289301 try :
290302 cov = coverage .Coverage (
291- config_file = rcfile_name ,
303+ config_file = os . environ . get ( "COVERAGE_RCFILE" , rcfile_name ) ,
292304 branch = True ,
293305 # NOTE: The messages arg controls what coverage prints to stdout/stderr,
294306 # which can interfere with the Bazel coverage command. Enabling message
295307 # output is only useful for debugging coverage support.
296308 messages = is_verbose_coverage (),
297- omit = [
298- # Pipes can't be read back later, which can cause coverage to
299- # throw an error when trying to get its source code.
300- "/dev/fd/*" ,
301- # The mechanism for finding third-party packages in coverage-py
302- # only works for installed packages, not for runfiles. e.g:
303- #'$HOME/.local/lib/python3.10/site-packages',
304- # '/usr/lib/python',
305- # '/usr/lib/python3.10/site-packages',
306- # '/usr/local/lib/python3.10/dist-packages'
307- # see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
308- "*/external/*" ,
309- ],
310309 )
311310 cov .start ()
312311 try :
0 commit comments