feat: new COVERAGEPY_IGNORE_ERRORS env var#2597
feat: new COVERAGEPY_IGNORE_ERRORS env var#2597BurnzZ wants to merge 2 commits intobazel-contrib:mainfrom
Conversation
|
I think it makes sense to provide a mechanism to let coveragepy ignore errors. I also wonder if it makes sense to provide a way for all of the coveragepy CLI arguments to be supplied? I think the torch errors that motivate this PR can probably also be avoided by excluding that source from coverage. Ignoring all errors would avoid the torch error, but possibly also mask others. To be clear, I still think there are valid scenarios to ignore all, so this PR still LGTM. WDYT @rickeylev |
Co-authored-by: Greg Roodt <[email protected]>
This was initially my approach but since there are 2 runs:
From coveragepy/coveragepy#1921 (comment), I think an alternative would be
Yeah, that's indeed another risk. Although, I think we should be fine since |
|
How about enabling ignore errors by default instead? |
|
That's one option but it could hide other potential issues by default. I think it'd be best if the user can first see the error, then decide if errors are to be ignored. This opt-in approach is sufficient for the time being. |
timothy-tlj-jones-canva
left a comment
There was a problem hiding this comment.
I heartily endorse this
|
Is this needed if we have #2607? |
…ests (#2607) This ensures that un-executed files _(i.e. files that aren't tested)_ are included in the coverage report. The current behavior is that coverage.py excludes them by default. This PR configures source files via the auto-generated `.coveragerc` file. See https://coverage.readthedocs.io/en/7.6.10/source.html#execution: > If the source option is specified, only code in those locations will be measured. Specifying the source option also enables coverage.py to report on un-executed files, since it can search the source tree for files that haven’t been measured at all. Closes #2599 Closes #2597 Fixes #2575 --------- Co-authored-by: Ignas Anikevicius <[email protected]>
Background
This is a proposal to have a workaround for #2575 where an inherent issue from coverage.py when creating the lcov output file.
Proposed Changes
An env var flag that a user can turn on via
--test_env=COVERAGEPY_IGNORE_ERRORS=truewhen runningbazel coverage.Reproducible steps
We can see how this proposal addresses the issue described from https://github.com/BurnzZ/rules_python.
MODULE.bazel:Issue from #2575 now resolved. 🎉