-
-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Dear developers of the coverage-conditional-plugin,
First, thank you for this nice plugin! It really makes a plus to tune our test suites!
I wanted to know if there was a way to make a "pytest marker"-based conditional coverage. Supposing I have defined a bunch of markers, e.g. "slow", "fast", "basic" and "extended", is it possible to define a conditional pragma based on the current pytest's "MARKEXPR".
That is, if you issue "pytest -m slow" for example, a line with something like "# pragma: no-cover-if-slow" would not be counted in the coverage. I guess this would need something like a special pragma-condition (something "similar" to the "is_installed" expression) for determining whether we are in the "right" marker. A set of rules could then be something like:
rules =
"pytest_runs_with_marker('slow')": no-cover-if-slow
...
Even better, could this be figured out at run time instead of "hard"-coded in the rules ?
But maybe there is another way or it is already possible ?
Any idea ?
Thanks a lot,
David