When I run Infection the command quits with an exception when executing slow tests.
Environment:
Cygwin64 under Window 10
Command run:
/cygdrive/c/php/php-7.1.1/php7.1.exe ../infection.phar -v
Error:
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "C:\php\php-7.1.1\php7.1.exe C:\Users\dmecke\Dropbox\PhpstormProjects\FatefulEncountersApi\phpunit.phar --configuration C:\cygwin64\tmp/infection/phpunitConfiguration.initial.infection.xml --stop-on-failure" exceeded the timeout of 60 seconds.
Trace:
() at phar://C:/Users/dmecke/Dropbox/PhpstormProjects/infection.phar/vendor/symfony/process/Process.php:1262
Symfony\Component\Process\Process->checkTimeout() at phar://C:/Users/dmecke/Dropbox/PhpstormProjects/infection.phar/vendor/symfony/process/Process.php:385
Symfony\Component\Process\Process->wait() at phar://C:/Users/dmecke/Dropbox/PhpstormProjects/infection.phar/vendor/symfony/process/Process.php:206
Symfony\Component\Process\Process->run() at phar://C:/Users/dmecke/Dropbox/PhpstormProjects/infection.phar/src/Process/Runner/InitialTestsRunner.php:59
Infection\Process\Runner\InitialTestsRunner->run() at phar://C:/Users/dmecke/Dropbox/PhpstormProjects/infection.phar/src/InfectionApplication.php:73
Infection\InfectionApplication->run() at phar://C:/Users/dmecke/Dropbox/PhpstormProjects/infection.phar/src/Command/InfectionCommand.php:98
Infection\Command\InfectionCommand->execute() at phar://C:/Users/dmecke/Dropbox/PhpstormProjects/infection.phar/vendor/symfony/console/Command/Command.php:261
Symfony\Component\Console\Command\Command->run() at phar://C:/Users/dmecke/Dropbox/PhpstormProjects/infection.phar/vendor/symfony/console/Application.php:866
Symfony\Component\Console\Application->doRunCommand() at phar://C:/Users/dmecke/Dropbox/PhpstormProjects/infection.phar/vendor/symfony/console/Application.php:220
Symfony\Component\Console\Application->doRun() at phar://C:/Users/dmecke/Dropbox/PhpstormProjects/infection.phar/vendor/symfony/console/Application.php:127
Symfony\Component\Console\Application->run() at phar://C:/Users/dmecke/Dropbox/PhpstormProjects/infection.phar/bin/infection:33
require() at C:\Users\dmecke\Dropbox\PhpstormProjects\infection.phar:10
My max_execution_time in the php.ini is set to 30 seconds and the timeout in the infection.json.dist to 10. So this seems to be a timeout somewhat related to PHPUnit maybe?
When I reduce my testsuite in the phpunit.xml to only the plain unit tests, it works fine. It seems to be related to the slower integration tests. When I execute the complete test suite with phpunit alone, there is no exception.
Thanks for posting this issue.
Are you able to run Infection with the same test suite on any other OS (Linux, MacOS)? Want to understand if it is windows-related issue since currently we don't have a stable windows build
Do you know have how can I reproduce it? I assume you ran it on private project
I was able to reproduce the same issue with one generic test on a linux machine:
<?php
use PHPUnit\Framework\TestCase;
class DummyTest extends TestCase
{
public function test_this_takes_really_long()
{
sleep(65);
$this->assertTrue(true);
}
}
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "exec /usr/bin/php7.1 /home/dmecke/test_infection/phpunit.phar --configuration /tmp/infection/phpunitConfiguration.initial.infection.xml --stop-on-failure" exceeded the timeout of
60 seconds.
$ php -v
PHP 7.1.7-1+0~20170711133844.5+jessie~1.gbp5284f4 (cli) (built: Jul 11 2017 14:13:18) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.7-1+0~20170711133844.5+jessie~1.gbp5284f4, Copyright (c) 1999-2017, by Zend Technologies
with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans
$ php phpunit.phar -v
PHPUnit 6.2.3 by Sebastian Bergmann and contributors.
Runtime: PHP 7.1.7-1+0~20170711133844.5+jessie~1.gbp5284f4 with Xdebug 2.5.5
Configuration: /home/dmecke/test_infection/phpunit.xml.dist
I have fixed this Infection's issue in #8
You will just need to update the timeout key in infection.json.dist file to needed value.
In case of the generic test above, this will be:
{
...
"timeout": 66,
...
}
I will release this fix tomorrow with other updates as a new tag if you don't mind.
Very nice, thanks a lot for the change and for the library in general, keep up the good work!
Released under 0.3.0