<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>Le Jul 16, 2012 à 6:40 AM, Dan Milstein <<a href="mailto:dan@wingu.com">dan@wingu.com</a>> a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family: 'Bitstream Vera Sans Mono'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">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.</span><div style="font-family: 'Bitstream Vera Sans Mono'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><br></div><div style="font-family: 'Bitstream Vera Sans Mono'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">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.</div></blockquote></div><br><div>Sorry, you're quite right that I misunderstood your question.</div><div><br></div><div>As Jean-Paul already said, this test code is quite old.</div><div><br></div><div>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.</div><div><br></div><div>-glyph</div><div><br></div></body></html>