That doesn't work with libraries. You can have a library consisting of two separate files that doesn't import each other.I also prefer to put my tests in its own files, in a separate directory. They are not imported by any other file.
->
I don't see this much an issue as expect good testing framework to becoupled with a build system anyway.