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