title: Getting loader on nose Plugin When Using Multiprocess
body: <p>We have a nose plugin that uses <code>loadTestsFromTestClass</code> to dynamically generate test cases from member methods.  Unfortunately, our plugin breaks apart when you try to run tests with the multiprocess plugin, because the multiprocess plugin loads all tests in the child process using <code>loadTestsFromNames</code>, thereby completely bypassing all our dynamic generation that ran in the parent process to produce the names to be run.  I've been working on fixing this, but have run in to a problem.</p>
  
  <p>We use the <code>prepareTestLoader</code> hook to store the loader to each instance of the plugin, and I want to use the loader in <code>loadTestsFromName</code> (this basic pattern is used in the builtin <code>isolate</code> plugin as well).  The problem is that the <code>prepareTestLoader</code> hook appears to only be triggered from <code>core.TestProgram.parseArgs</code>, and worker processes don't even create <code>TestProgram</code>s at all, so when the workers hit my <code>loadTestsFromName</code> hook, they raise an <code>AttributeError</code> since <code>prepareTestLoader</code> was never called and thus the loader was never added to the plugin instance.</p>
  
  <p>I do have the test name which in turn has the module path, so I could try to use <code>nose.importer.Importer</code> to grab the module and then do my dynamic loading from there, but I'd rather stay at a higher level within <code>nose</code> if possible.  Does anyone have any ideas or experience, short of modifying <code>nose</code> directly to fire the <code>prepareTestLoader</code> hook from within <code>nose.plugins.multiprocess.__runner</code> directly?</p>
  
  <p><strong>Edit:</strong>
  I hacked a workaround for dynamically loading the tests by calling <code>loadTestsFromTestClass</code> from <code>loadTestsFromName</code> when I have a module and can find an attribute on it that matches the first part of the test name, but I can't really test it because <code>loadTestsFromTestClass</code> relies on <code>loader.makeTest</code>, which I still don't have thanks to the original problem.  I really need some hook that is run in subprocesses before test loading that has both the loader and plugin instance within scope...</p>