Multithread testing, non-travis

Half of #732.

This is the part that does all of the work to make the tests threadsafe and runnable in parallel when coveralls is not being used. 

It leaves out the part that enables this on Travis.