-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
@runClassInSeparateProcess has the same effect as @runTestsInSeparateProcesses #3258
Comments
@runClassInSeparateProcess
has the same effect as @runTestsInSeparateProcesses
I am seeing the same issue with phpUnit 7.4.0. Despite @runClassInSeparateProcesss annotation the individual tests in a class are all run in isolation to each other rather run in the same process but isolated to others classes. So there is no visible difference between @runClassInSeparateProcesss and @runTestsInSeparateProcesses and the expected speed improvement for setting up a process only once for a class does eventuate. |
@sebastianbergmann Can you see if this can be fixed? It makes tests run very slowly. I can create a pull request if it's something simple. |
@hwmaier @bugreportuser I am working on this right now. Will take me a bit of time to read up on the context. #2591 has multiple end-to-end tests and moving parts, however none of these is failing. I'll dig into this and report back here. |
@epdenouden I am happy to assist and run a possible fix against our test cases. |
@epdenouden Thanks. It's good to see this being worked on. I checked why the test fails, and it's because it doesn't run the bootstrap file. It passes when the bootstrap file runs, however the test is wrong. It should be: public function testGlobalString(): void
{
- $this->assertEquals('Hello', $GLOBALS['globalString']);
+ $this->assertEquals('Hello! I am changed from inside!', $GLOBALS['globalString']);
}
} The test does fail when that line is changed. |
TL;DR @hwmaier thanks, I surely will take you up on the offer! Background It appears as though the 'in seperate process' piece of logic in phpunit/src/Framework/TestCase.php Lines 690 to 705 in 34114e8
There are two slightly different code templates to run either a complete class or an individual test in a seperate PHPUnit process. These templates look sensible. However, there doesn't seem to be any code at the |
@epdenouden I recently moved to another test framework so this issue isn't a priority for me anymore. The slow tests were affecting productivity so I decided it was time to switch. Thanks for your work on the issue. @hwmaier Is this still important to you? I don't want to suggest delaying a fix if you're still waiting. |
@bugreportuser The issue is not critical and I have workarounds at present, so from my point this can wait. |
So the comments above don‘t count as activity? "Not super urgent“ does not mean it is not a valid issue. |
@epdenouden Can I help in any way? I'm not very familiar with PHPUnit's internals, but I think this would be an important bug to fix. |
@sebastianbergmann could you please add a link to the pull request/commit that fixed this issue? Or maybe list the version(s) since which the fix is included? I can't seem to find this change in any of the changelog files. |
Please fix this, still not working correctly |
I have found out that the templates are identical, either |
|
Superseded by #5230 |
@sebastianbergmann Thanks for the information, I'd love to create a pull request once I figure out how the process isolation works :) |
@WalterWoshid Great! Thank you for looking into this. |
@runClassInSeparateProcess
has the same effect as@runTestsInSeparateProcesses
and makes test SeparateClassPreserveTest.php fail when it's run by itself. My project has the same problem so I think the problem is with the annotation.The older versions I tested have the same problem.
It makes sense for the first test to fail but the third shouldn't.
All tests pass when run together.
The text was updated successfully, but these errors were encountered: