Le Jul 16, 2012 à 6:40 AM, Dan Milstein <d...@wingu.com> a écrit :

> 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.

Sorry, you're quite right that I misunderstood your question.

As Jean-Paul already said, this test code is quite old.

If you want to be diagnosing what's going on in a test, writing a (temporary) 
IProtocol or ITransport wrapper that has some print statements in it can be a 
good way to go.  Or as Itamar suggested, using StringTransport() and printing 
its contents.  Definitely using StringTransport would be preferred for anything 
you'd actually want to keep around in a test if you want to assert about what's 
being read or written, and not just look at a dump of the output.

-glyph

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to