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