Custom PHP Unit test trait for a custom module cannot be found I have created a new Trait for testing my custom module and placed it in my_module/tests/src/Traits with the namespace Drupal\Test\my_module\Traits, the same as core modules do.
When I try to use this in my PHP Unit kernel test I just get the following error:
Fatal error: Trait 'Drupal\Test\my_module\Traits\CustomTrait' not found

Is there something special that needs to be included to allow custom traits in testing?
The namespace should Drupal\Tests\my_module\Traits - notice this is Tests with an s at the end, not Test