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