Problem/Motivation
Although this is a kernel test it runs 40 tests methods, 5 of which skip after doing a fair bit of setup.
Steps to reproduce
(numbers from my local dev environment)
Before:
Time: 01:00.910, Memory: 6.00 MB
OK, but some tests were skipped!
Tests: 40, Assertions: 2835, Skipped: 5.
After:
Time: 00:55.201, Memory: 6.00 MB
OK, but some tests were skipped!
Tests: 43, Assertions: 2500, Skipped: 8.
There are three more tests skipped and you would expect because of the way that data providers work, confirmed it's the same five methods getting skipped, just we mark one skipped three times instead of once this way.
On gitlab:
Before:
Drupal\Tests\content_moderation\Kernel\WorkspacesContentMode 40 passes 133s
After:
Drupal\Tests\content_moderation\Kernel\WorkspacesContentMode 43 passes 122s
This isn't saving lots of time, but it's saving a few seconds from what is a very long test for a kernel test (on slower pods it can take a fair bit longer than 130s).
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3468829
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
catchComment #4
catchComment #5
smustgrave commentedI'm willing to bet that this change didn't break nightwatch. Neat solution for skipping those tests
Comment #11
nod_Committed and pushed f06e0f3f47 to 11.x and 7135f09a09 to 11.0.x and 9a0f1ff644 to 10.4.x and e53b039258 to 10.3.x. Thanks!
Comment #14
nod_seems it's causing issues in 10.4.x and 10.3.x reverting them for now
ex: https://git.drupalcode.org/project/drupal/-/pipelines/260708/test_report...
Comment #15
spokjeSetting to the IMHO correct state.
Comment #19
spokjeComment #20
spokjeComment #21
spokjeLooks like we hit an interesting difference between PHPUnit 9 and 10.
In 9, for a test to be picked up by its class'
setUp()it has to be defined in that class, even though there's also an implementation in its base-class.In 10, when there's a definition in the base-class, the
setUp()of the extending class will pick up on each test, even when only defined in the base-class.Added some empty-bodied (except some explanatory comment) tests-to-be-skipped and all seems well now in the land of 10.x
Comment #24
nod_Perfect, thanks.
Committed and pushed 7f653a7d6b to 10.4.x and b3ac46aee4 to 10.3.x. Thanks!