<br><br><div class="gmail_quote">On Wed, Oct 14, 2009 at 4:43 AM, Steve Steiner (listsin) <span dir="ltr">&lt;<a href="mailto:listsin@integrateddevcorp.com">listsin@integrateddevcorp.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><br><div><div class="im"><div>On Oct 14, 2009, at 2:07 AM, Glyph Lefkowitz wrote:</div><div><br></div></div><div>Yes, we&#39;re working on it but it&#39;s a large code base and we started with exactly zero tests.  While that leaves infinite room for improvement, it&#39;s a little overwhelming.  Oh well, at least we know where to concentrate first ;-0.</div>
</div></div></blockquote><div><br></div><div>I realize it&#39;s a challenge, but, well, &quot;Doctor, doctor, it hurts when I don&#39;t do this!&quot;.  My immediate reaction is &quot;go ahead and do it, then&quot; :-).</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div><div class="im"><blockquote type="cite"><div class="gmail_quote"><div>Trial will helpfully fail tests which cause exceptions to be logged, so you don&#39;t need to write any special extra test to make sure that nothing is blowing up; just test your error-handling case, and if it blows up you will see it.<br>
</div></div></blockquote><div><br></div></div><div>We&#39;ve just been using nose; is that something Trial handles specially for Twisted?</div></div></div></blockquote><div><br></div><div>Yes.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><div><div class="im"><blockquote type="cite"><div class="gmail_quote"><div>If you want to handle logged exceptions specially, for example to put them in a separate file, or to e-mail them to somebody, consider writing a log observer that checks for the isError key and does something special there.  You can find out more about writing log observers here: &lt;<a href="http://twistedmatrix.com/projects/core/documentation/howto/logging.html" target="_blank">http://twistedmatrix.com/projects/core/documentation/howto/logging.html</a>&gt;.<br>
</div></div></blockquote><div><br></div></div>This is an area of Twisted I haven&#39;t explored at all since the code&#39;s all using the standard Python logging.   <br></div><div>That&#39;s the thing about Twisted; sometimes it&#39;s hard to know whether the stuff that has been built into standard Python since Twisted &#39;rolled their own&#39; is a superset, a subset, or a completely different beast.  Logging is a good case in point.  Since we&#39;re using Python&#39;s logging everywhere, I wasn&#39;t even sure whether there would be an advantage to learning Twisted&#39;s similar system.  Twisted&#39;s trial is another example; we&#39;ve just been using nose.  Seems like there&#39;s always some little extra that makes the Twisted stuff worth knowing.</div>
</div></blockquote><div><br></div><div>Another option here would be to set up a PythonLoggingObserver that relay&#39;s Twisted&#39;s log messages to Python standard logging, then setup a standard log handler (another poster suggests nose already does this) to fail the test when appropriate.  I&#39;m fairly sure that the information you need is being properly relayed to the relevant parties, but if I&#39;m wrong, it&#39;s a bug and probably a pretty easy one to fix :).</div>
<div><br></div></div>