Error running a PHPUnit test only under run-tests.sh
@Berdir is completely correct here:


  I'm not sure but you might not be able to have a non-test class in the tests/src location, try moving that to module/src/... and change the namespace accordingly (Drupal\module...


While PHPUnit doesn't mind if a test class uses a trait that's in a Drupal\Tests namespace, the simpletest test runner run-tests.sh will be unable to find the trait if you do this.

So don't do that.

Even if a trait is used only with your test classes, if you want your code to get past the Drupal testbot, the trait needs to live somewhere in your Drupal\your_module\ namespace. Do this, and both phpunit and run-tests.sh will be happy.