Open nedbat opened 6 years ago
Original comment by John Sirois (Bitbucket: jsirois, GitHub: jsirois)
Ah, looks like combine
doesn't have any include/exclude filtering, so I think running 1 combine
per source root won't do the trick. The 1st run will just map all symlink farm files to the 1st source root and then all remaining combine
s will no-op.
@jsirois Thanks for the report, and for trying the plugins! Help me understand what you are trying to accomplish with your plugin: what's the larger problem you are trying to solve?
Original comment by John Sirois (Bitbucket: jsirois, GitHub: jsirois)
Downstream issue for extra context: https://github.com/pantsbuild/pants/issues/5426
Issue #645 was marked as a duplicate of this issue.
Originally reported by John Sirois (Bitbucket: jsirois, GitHub: jsirois)
N.B.: Obsoletes https://bitbucket.org/ned/coveragepy/issues/645/modifying-coverage-reporting-for-python
Currently the plugin api for providing a custom reporter is
def file_reporter(filename) -> FileReporter
. This API makes it hard to subclassPythonFileReporter
since its constructor takes and optionalcoverage
argument in addition to themorf
to report on. In particular, theCoverage
instance is not optional for the successful execution offr.parser
andfr.no_branch_lines
. This can be worked around ~like so:The workaround is necessitated by the plugin lifecycle as it stands, where there is no access to the active
Coverage
instance FWICT. It looks like configuring plugins set up a bit of chicken/egg ifCoverage
passed itself intocoverage_init
; although, this would work in the example case since by the timeMyFileReporter
actually used the passed-inCoverage
instance, it would be fulliy _init'ed. Perhaps theCoveragePlugin
API could havedef python_file_reporter(filename, coverage) -> PythonFileReporter
method added or else there could be aPythonCoveragePlugin
orCoveragePlugin2
API that amended the existingfile_reporter
API signature. ...Or, perhaps I'm missing something! That would be best.I'm happy to whip up a patch if one is needed and any of these ideas or others would work.