[Twisted-Python] How to best log server/client interactions from a test?

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Mon Jul 16 13:23:54 EDT 2012

On 01:40 pm, dan at wingu.com wrote:
>To be clear: my current interest is really just doing this during unit 
>tests/ongoing development (e.g. not diagnosing prod issues, where 
>Wireshark would make plenty of sense).  So something integrated into 
>Twisted feels natural.
>That said, is the unit test pattern I'm seeing in the 
>mail/test/test_imap.py module atypical?  Most of the doc'd examples for 
>trial don't seem to be using loopbackTCP, so much as directly writing 
>to lineReceived or something similar.  It's only because these tests 
>are doing end-to-end things, by way of constructing both an IMAP server 
>and client, and hooking them up, that I'm in this situation.

Most of the tests in twisted/mail/test/test_imap.py were written with a 
very limited understanding of good unit testing practices.  I would not 
recommend emulating them.


More information about the Twisted-Python mailing list