<br><br><div class="gmail_quote">On Jan 28, 2008 4:09 PM, Jean-Paul Calderone &lt;<a href="mailto:exarkun@divmod.com">exarkun@divmod.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Mon, 28 Jan 2008 11:09:44 +0100, holger krekel &lt;<a href="mailto:holger@merlinux.de">holger@merlinux.de</a>&gt; wrote:<br>&gt;Hi Ralf,<br>&gt;<br>&gt;On Mon, Jan 28, 2008 at 05:53 +0100, Ralf Schmitt wrote:<br>
&gt;&gt; On Jan 26, 2008 1:39 PM, holger krekel &lt;<a href="mailto:holger@merlinux.de">holger@merlinux.de</a>&gt; wrote:<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; I could use contributions or help (or sometimes just hints) in<br>
&gt;&gt; &gt; the following particular areas:<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; - integrating py.test with Twisted<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; <a href="http://systemexit.de/repo/py.test.twisted/" target="_blank">http://systemexit.de/repo/py.test.twisted/</a> contains a mercurial repository,<br>
&gt;&gt; which makes testing code running under the twisted reactor possible. (I&#39;ve<br>&gt;&gt; already asked about integrating it into the py library).<br><br></div>Is it intentional that this integration busy-loops, guaranteeing 100% CPU<br>
usage for the entire test-run?<br><font color="#888888"></font></blockquote><div><br>Why do you think so? Apparently this isn&#39;t true on my machine:<br><br>~/py.test.twisted/ cat test_some.py&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ralf@red ok<br>
#! /usr/bin/env py.test.twisted<br><br>from twisted.internet import defer, reactor<br>from twisted.python import failure<br>from twisted.python import log<br><br>def test_deferred():<br>&nbsp;&nbsp;&nbsp; d = defer.Deferred()<br>&nbsp;&nbsp;&nbsp; def done():<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log.msg(&quot;done&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; d.callback(None)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; reactor.callLater(25, done)<br>&nbsp;&nbsp;&nbsp; log.msg(&quot;Returning %r&quot; % (d,))<br>&nbsp;&nbsp;&nbsp; return d<br><br>def test_defer_fail():<br>&nbsp;&nbsp;&nbsp; def fun():<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log.msg(&quot;provoking NameError&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rsdfg<br>&nbsp;&nbsp;&nbsp; return defer.maybeDeferred(fun)<br>~/py.test.twisted/ time ./py.test.twisted test_some.py&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ralf@red ok<br>2008-01-29 07:01:14+0100 [-] Log opened.<br>
============================= test process starts ==============================<br>executable:&nbsp;&nbsp; /home/ralf/py25/bin/python&nbsp; (2.5.2-alpha-0)<br>using py lib: /home/ralf/py25/lib/python2.5/site-packages/py-0.9.0-py2.5.egg/py &lt;rev unknown&gt;<br>
<br>test_some.py[2] .F<br><br>________________________________________________________________________________<br>_________________________ entrypoint: test_defer_fail __________________________<br><br>&nbsp;&nbsp;&nbsp; def fun():<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log.msg(&quot;provoking NameError&quot;)<br>
E&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rsdfg<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NameError: global name &#39;rsdfg&#39; is not defined<br><br>[/home/ralf/py.test.twisted/test_some.py:20]<br>- - - - - - - - - - -&nbsp; test_defer_fail: recorded stdout - - - - - - - - - - - -<br>2008-01-29 07:01:39+0100 [-] provoking NameError<br>
<br>________________________________________________________________________________<br>============= tests finished: 1 passed, 1 failed in 25.00 seconds ==============<br>2008-01-29 07:01:39+0100 [-] Main loop terminated.<br>
./py.test.twisted test_some.py&nbsp; 0.22s user 0.06s system 1% cpu 25.278 total<br><br><br></div></div>