Turn mocks on at runtime

Instead of turning mocks on when we write the code we now do it at
runtime by adding an init function to the test code file.  This then
makes it possible to have one set of tests mock a package, whilst as
second set of tests does not.

fixes #23.