Since #19079, this is done automatically. More specifically, test filtering works on fully qualified names.
As an example, here are two fully qualified test names from std.math:
math.test.max value type
math.decltest.isPowerOfTwo
so filtering for math. would include all the tests in std.math.
(for compleness, here’s an example of a fully qualified test name with a more nested namespace: crypto.25519.x25519.test.rfc7748 vector1)