New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@codeCoverageIgnore on a docblock should prevent driver start/stop #3697
Comments
What you want can be achieved with the |
Thanks @sebastianbergmann, It looks like From what I see, phpunit calls
As a result, I also notice that the test for that function (tests/unit/Framework/TestResultTest.php::testCanSkipCoverage) seems to be inverted. |
At the moment if you specify
@codeCoverageIgnore
on an individual test function or testcase class then that entire test or group of tests is not included in coverage generation. However, this only filters the data which is collected, rather than preventing the collection in the first place.Whilst the collection is still required in some situations, specifically where a single line is ignored (
// @codeCoverageIgnore
), or a range of lines via the@codeCoverageIgnoreStart
and@codeCoverageIgnoreEnd
tags, where the entire class or an entire function is ignored then I feel it would be prudent to not start the driver at all.This becomes a problem when testing large and complex datasets as the fact that the driver is logging at all causes high memory consumption leading to out of memory. To give a more concrete example, we have one dataset related to machine learning where generation of the data consumes 76GB of memory via opcache alone. At the moment our only solutions are to either add a
@group
tag to the relevant test and ignore it from phpunit when we wish to generate coverage at all, or to add a hack before and after the test to stop/restart the opcache logging if it is enabled.I'd like to propose that php-code-coverage either:
@codeCoverageIgnore
tag is applied to an entire testcase class, or test function within that testcase class; orI'm aware that xdebug now supports some filters, but unfortunately phpdbg does not do so yet.
If you feel that this would be a beneficial change I'm more than happy to help in its development.
The text was updated successfully, but these errors were encountered: