Can you not just change to going through each module running the hosts manually? Then you can do what you like before and after each.

If your lib had  a host that started a thread which received messages about a unittest registering itself in other user modules you could run the unittests as  you feel like and you could stick with the -unittest dmd arg.
Reason for the thread is you can't control order of module initialization.

On 23 Sep 2013 21:30, "Gary Willoughby" <dev@nomad.so> wrote:
On Monday, 23 September 2013 at 16:40:56 UTC, jostly wrote:
Let's not end up in that situation, but rather work out a common API to run unit tests, and the D unit test community can be the envy of every other unit tester. :)

You've raised some nice ideas and got me thinking. However, i do think we are missing some way of knowing when unit tests start and stop. I like the built in unittest blocks but it would be nice to have something like:

    beforetests
    {
        ...
    }

    aftertests
    {
        ...
    }

To apply code before and after the unit tests have run. These could be used to setup and the execute the reporting environment? I can't think of a way to do this automatically without these constructs.