@@ -309,29 +309,28 @@ def _maybe_collect_coverage(enable):
309
309
relative_files = True
310
310
source =
311
311
\t { source }
312
+ omit =
313
+ # Pipes can't be read back later, which can cause coverage to
314
+ # throw an error when trying to get its source code.
315
+ /dev/fd/*
316
+ # The mechanism for finding third-party packages in coverage-py
317
+ # only works for installed packages, not for runfiles. e.g:
318
+ #'$HOME/.local/lib/python3.10/site-packages',
319
+ # '/usr/lib/python',
320
+ # '/usr/lib/python3.10/site-packages',
321
+ # '/usr/local/lib/python3.10/dist-packages'
322
+ # see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
323
+ */external/*
312
324
"""
313
325
)
314
326
try :
315
327
cov = coverage .Coverage (
316
- config_file = rcfile_name ,
328
+ config_file = os . environ . get ( "COVERAGE_RCFILE" , rcfile_name ) ,
317
329
branch = True ,
318
330
# NOTE: The messages arg controls what coverage prints to stdout/stderr,
319
331
# which can interfere with the Bazel coverage command. Enabling message
320
332
# output is only useful for debugging coverage support.
321
333
messages = is_verbose_coverage (),
322
- omit = [
323
- # Pipes can't be read back later, which can cause coverage to
324
- # throw an error when trying to get its source code.
325
- "/dev/fd/*" ,
326
- # The mechanism for finding third-party packages in coverage-py
327
- # only works for installed packages, not for runfiles. e.g:
328
- #'$HOME/.local/lib/python3.10/site-packages',
329
- # '/usr/lib/python',
330
- # '/usr/lib/python3.10/site-packages',
331
- # '/usr/local/lib/python3.10/dist-packages'
332
- # see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
333
- "*/external/*" ,
334
- ],
335
334
)
336
335
cov .start ()
337
336
try :
0 commit comments