@@ -291,29 +291,28 @@ def _maybe_collect_coverage(enable):
291
291
rcfile .write (
292
292
"""[run]
293
293
relative_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/*
294
306
"""
295
307
)
296
308
try :
297
309
cov = coverage .Coverage (
298
- config_file = rcfile_name ,
310
+ config_file = os . environ . get ( "COVERAGE_RCFILE" , rcfile_name ) ,
299
311
branch = True ,
300
312
# NOTE: The messages arg controls what coverage prints to stdout/stderr,
301
313
# which can interfere with the Bazel coverage command. Enabling message
302
314
# output is only useful for debugging coverage support.
303
315
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
- ],
317
316
)
318
317
cov .start ()
319
318
try :
0 commit comments