[Twisted-Python] the right way of unit testing protocols

Jeethu Rao jeethur at sancharnet.in
Wed Jul 30 14:56:07 EDT 2003

What is the right way of unit testing protocols in twisted ?
Currently, I'm just subclassing my protocol with unittest.TestCase
And directly calling the dataRecieved with a string and am checking
If the overridden callbacks (like dataRecieved) are called.

The tests pass, but back when I was writing threaded servers,
I would actually setup a server on localhost and would connect to
The server from another thread, for unit testing. That gives me a lot
more confidence.

I know that I can setup two reactors, for the client and the server
and then try to make them talk, But I'm sure there's a shortcut.
I just could'nt figure out the test suites from the Twisted sources.

Jeethu Rao

More information about the Twisted-Python mailing list