pygradle icon indicating copy to clipboard operation
pygradle copied to clipboard

'term:skip-covered' should be used in preference to 'term'

Open wadetregaskis-linkedin opened this issue 6 years ago • 7 comments

In reporting to the terminal, the pertinent information is the missing coverage - I don't need to see a long list of files with 100% coverage. I still want that in the other reports, because e.g. my CI pipeline might set requirements on overall coverage - so I can't just put 'skip_covered = true' in my setup.cfg.

wadetregaskis-linkedin avatar Nov 20 '19 21:11 wadetregaskis-linkedin

Can you just add

[report]
skip_covered=true

to your setup.cfg?

warsaw avatar Nov 21 '19 00:11 warsaw

Unfortunately not - I tried that, but it applies to all reports, not just the one output to the terminal. That's what I was alluding to in my original comment here.

I also tried re-setting it to false specifically in the [coverage:html] et al sections, but unfortunately it's apparently not supported in those sections (evidently they're not logical 'subclasses' of the 'report' section).

wadetregaskis-linkedin avatar Nov 21 '19 01:11 wadetregaskis-linkedin

Ah, sorry; you wrote skip_missing so that threw me off.

FWIW, I like the 100% coverage output.

Unfortunately, I'm not sure if what you want is supported by coverage.

warsaw avatar Nov 21 '19 01:11 warsaw

Whoops! Sorry for the confusion. Properties - they're all the same, right? ;)

wadetregaskis-linkedin avatar Nov 21 '19 01:11 wadetregaskis-linkedin

It is supported - AFAICT that's why 'term:missing' exists, as a special-case way to override skip_covered only for terminal output. It unfortunately appears to be the only way to do that, and I don't see any way to otherwise modify what the coverage pygradle plugin passes to pytest w.r.t. these parameters.

wadetregaskis-linkedin avatar Nov 21 '19 01:11 wadetregaskis-linkedin

FYI, this change would have to be made in PyCoverageTask.groovy:

    public void preExecution() {
        // using subArgs as these must be added after py.test
        subArgs(
            '--cov',
            project.file(component.srcDir).getAbsolutePath(),
            '--cov-report=xml',
            '--cov-report=html',
            '--cov-report=term'
        )

        super.preExecution()
    }

We would have to think about how to make this configurable since we still want to support --cov-report=term.

warsaw avatar Nov 21 '19 18:11 warsaw

Agreed making it configurable would be wise. I have no objection if I have to explicitly turn this on within build.gradle or similar - so long as there's some way for me to do so.

wadetregaskis-linkedin avatar Nov 21 '19 18:11 wadetregaskis-linkedin