I don't think it works that way, as how could a compile time test module know about modules that have pulled it in?
Exactly. __traits work during compile-time. If module is not imported, it is not known during compile-time -> no trait unittest access possible. In lot of programs it will be accessible recursively via some indirect import though.