@@ -350,29 +350,28 @@ def _maybe_collect_coverage(enable):
350
350
rcfile .write (
351
351
"""[run]
352
352
relative_files = True
353
+ omit =
354
+ # Pipes can't be read back later, which can cause coverage to
355
+ # throw an error when trying to get its source code.
356
+ /dev/fd/*
357
+ # The mechanism for finding third-party packages in coverage-py
358
+ # only works for installed packages, not for runfiles. e.g:
359
+ #'$HOME/.local/lib/python3.10/site-packages',
360
+ # '/usr/lib/python',
361
+ # '/usr/lib/python3.10/site-packages',
362
+ # '/usr/local/lib/python3.10/dist-packages'
363
+ # see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
364
+ */external/*
353
365
"""
354
366
)
355
367
try :
356
368
cov = coverage .Coverage (
357
- config_file = rcfile_name ,
369
+ config_file = os . environ . get ( "COVERAGE_RCFILE" , rcfile_name ) ,
358
370
branch = True ,
359
371
# NOTE: The messages arg controls what coverage prints to stdout/stderr,
360
372
# which can interfere with the Bazel coverage command. Enabling message
361
373
# output is only useful for debugging coverage support.
362
374
messages = is_verbose_coverage (),
363
- omit = [
364
- # Pipes can't be read back later, which can cause coverage to
365
- # throw an error when trying to get its source code.
366
- "/dev/fd/*" ,
367
- # The mechanism for finding third-party packages in coverage-py
368
- # only works for installed packages, not for runfiles. e.g:
369
- #'$HOME/.local/lib/python3.10/site-packages',
370
- # '/usr/lib/python',
371
- # '/usr/lib/python3.10/site-packages',
372
- # '/usr/local/lib/python3.10/dist-packages'
373
- # see https://github.com/nedbat/coveragepy/blob/bfb0c708fdd8182b2a9f0fc403596693ef65e475/coverage/inorout.py#L153-L164
374
- "*/external/*" ,
375
- ],
376
375
)
377
376
cov .start ()
378
377
try :
0 commit comments