coverage per class methods · Issue #1532 · nedbat/coveragepy (original) (raw)

Is your feature request related to a problem? Please describe.

I have a class with many methods that I regularly test with pytest. Unfortunately, it outputs missing lines for the whole class (module), like

yarsync/yarsync.py 1031 259 75% 60, 69-70, 77, 160-167, ...

It would be great to split the output based on class methods.

Describe the solution you'd like

Provide an option to print class methods (as is done for different files, but now for different scopes in one file).

Describe alternatives you've considered

I tried annotate, but that seems redundant (and already discouraged).
I asked StackOverflow, and they proposed coverage html, but for me it's much easier to run the command from terminal and use no browser for html (1 command vs 2).

Additional context

I write a Python script for file synchronization. It is one file (because it is a script), but it gets more complicated because the class has many methods.