[py-dev] [TIP] towards 1.0 / code URLS using py.test?

Ralf Schmitt schmir at gmail.com
Tue Jan 29 07:02:28 CET 2008


On Jan 28, 2008 4:09 PM, Jean-Paul Calderone <exarkun at divmod.com> wrote:

> On Mon, 28 Jan 2008 11:09:44 +0100, holger krekel <holger at merlinux.de>
> wrote:
> >Hi Ralf,
> >
> >On Mon, Jan 28, 2008 at 05:53 +0100, Ralf Schmitt wrote:
> >> On Jan 26, 2008 1:39 PM, holger krekel <holger at merlinux.de> wrote:
> >> >
> >> > I could use contributions or help (or sometimes just hints) in
> >> > the following particular areas:
> >> >
> >> > - integrating py.test with Twisted
> >>
> >>
> >> http://systemexit.de/repo/py.test.twisted/ contains a mercurial
> repository,
> >> which makes testing code running under the twisted reactor possible.
> (I've
> >> already asked about integrating it into the py library).
>
> Is it intentional that this integration busy-loops, guaranteeing 100% CPU
> usage for the entire test-run?
>

Why do you think so? Apparently this isn't true on my machine:

~/py.test.twisted/ cat test_some.py                                 ralf at redok
#! /usr/bin/env py.test.twisted

from twisted.internet import defer, reactor
from twisted.python import failure
from twisted.python import log

def test_deferred():
    d = defer.Deferred()
    def done():
        log.msg("done")
        d.callback(None)

    reactor.callLater(25, done)
    log.msg("Returning %r" % (d,))
    return d

def test_defer_fail():
    def fun():
        log.msg("provoking NameError")
        rsdfg
    return defer.maybeDeferred(fun)
~/py.test.twisted/ time ./py.test.twisted test_some.py              ralf at redok
2008-01-29 07:01:14+0100 [-] Log opened.
============================= test process starts
==============================
executable:   /home/ralf/py25/bin/python  (2.5.2-alpha-0)
using py lib: /home/ralf/py25/lib/python2.5/site-packages/py-0.9.0-py2.5.egg/py
<rev unknown>

test_some.py[2] .F

________________________________________________________________________________
_________________________ entrypoint: test_defer_fail
__________________________

    def fun():
        log.msg("provoking NameError")
E       rsdfg
>       NameError: global name 'rsdfg' is not defined

[/home/ralf/py.test.twisted/test_some.py:20]
- - - - - - - - - - -  test_defer_fail: recorded stdout - - - - - - - - - -
- -
2008-01-29 07:01:39+0100 [-] provoking NameError

________________________________________________________________________________
============= tests finished: 1 passed, 1 failed in 25.00 seconds
==============
2008-01-29 07:01:39+0100 [-] Main loop terminated.
./py.test.twisted test_some.py  0.22s user 0.06s system 1% cpu 25.278 total
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20080129/b2f4e71c/attachment.html>


More information about the Pytest-dev mailing list