[Twisted-Python] Defer until a server is ready?

Eric P. Mangold eric at teratorn.org
Mon Oct 21 16:45:29 MDT 2013


On Mon, Oct 21, 2013 at 03:08:56PM -0700, Russell E. Owen wrote:
> For unit testing and other reasons I would like to launch a server in a 
> subprocess, then wait until it is available before running some code 
> that uses it. Is there a standard paradigm for this, e.g. poll until a 
> connection is accepted, or have the server emit some kind of "ready" 
> signal (such as a message to stdout or a UDP packet)? Any advice would 
> be appreciated. A web search didn't turn up anything.
 
Emitting a message on stdout has worked well for me before.

You can wait for this in your ProcessProtocol then continue
the test case once you receieve it.

	-E




More information about the Twisted-Python mailing list