Wraps ioloop fetcher for unit tests in a function.

Otherwise, the ioloop instance is fetched in the main loop
but launched in a separate thread, which seems to cause problems.
Hopefully this fixes sporadic deadlocks in unit tests