-
Notifications
You must be signed in to change notification settings - Fork 17
Description
I discovered this while helping on #207, but the issue I want to report is actually quite orthogonal to that PR, so I'm opening this ticket separately.
In short, I would like to make pytest-cov a choice rather than a hard requirement for coverage reporting; this plugin is merely more than a middle man and provides no actual functionality on its own, so I would like to eliminate it from dependency graphs to reduce the "attack surface" (not exclusively, but also in the security sense) for dependees.
Running coverage directly isn't really challenging in itself, it should be as simple as the following substitution:
pytest ... --cov --cov-report=xml
coverage run --parallel-mode -m pytest
coverage combine
coverage xml
Note that, by virtue of coverage being a hard dependency to pytest-cov, it would be perfectly backwards compatible to use it directly.
The difficulty lies in how to approach this; here's a summary of the design constraints we're facing.
tox.yml(viatoxitself) can only append arguments to a command viamatrix.pytest_flag, which tox redirects asposargs- in order to automatically form a
coveragecommand dynamically, I need to be able to prependcoverage run -mbefore the pytest invoke - I would also need to somehow be able to add dynamically generated commands to invoke
coverage combineorcoverage xml...
This just seems impossible to do in the most general case. My preferred solution would be to renounce doing this stuff dynamically and let users define their own commands (using pytest-cov or coverage directly, at their discretion); but of course that'd be a breaking change. I will try to come up with a backward compatible transition plan.
Originally posted by @neutrinoceros in #207 (comment)