pytest-dev / pytest-cov

Coverage plugin for pytest.
MIT License
1.72k stars 211 forks source link

Feature: add diff_cover? #600

Open tlambert03 opened 1 year ago

tlambert03 commented 1 year ago

I'm wondering if you've considered (or would consider a PR) implementing support for diff_cover?

I'm thinking something like pytest --cov --cov-report=term-diff, which would essentially run diff_cover and add it to the report? I took a stab at implementing this as an independent pytest plugin (that would in turn use pytest-cov), but found that it was rather difficult (and probably bad form) to essentially modify the pytest-cov plugin instance to achieve this.

I'm happy to open PR trying to implement this, but wanted to gauge interest first. thanks!

nedbat commented 1 year ago

Instead of further complicating pytest-cov, why not run diff-cover as a command of its own?

tlambert03 commented 1 year ago

yep, a two step process is definitely an alternative :) ... but you could make a similar argument for reports in general right? Why not just run coverage report after running pytest --cov to generate the xml?