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