meejah/txtorcon — pull request #24 by hellais (2012-11-26 21:31:38+00:00)
Title: Timeout support for launch_tor

I added support for starting Tor with a timeout.

I had some issues in writing the unittests, so perhaps you may not want to merge that part of it, though you should be able to test the failure by doing a:

self.clock.advance(timeout+1)

after you do:

d = launch_tor(config, FakeReactor(self, trans, on_protocol), connection_creator=creator, timeout=timeout)

and then checking that it failed with

self.assertFailure(d, TorSetupTimeout)

Also I was a bit uncertain as to how exactly tor_connection_failed() should be used. In particular I did not understand why it was returning None and therefore swallowing exceptions that would be raised.