[Twisted-Python] Naming test methods constructed with deferredGenerator - is it possible?

Marcin Kasperski Marcin.Kasperski at softax.com.pl
Fri Apr 28 06:14:34 MDT 2006


In my trial tests I have a few test methods constructed using 
deferredGenerator idiom. Something like that:

  def testSomething(self):
       # ... do something
       yield defer.waitForDeferred(someDeferred)
       # ... do something
       yield defer.waitForDeferred(otherDeferred)
       # ... do something
  testSomething = defer.deferredGenerator(testSomething)

Let's write clean code and works perfectly.    ... Almost.
The problem is that in the verbose test output I get 

      <lambda> ...                        [OK]

Of course I would prefer

     testSomething ...                   [OK]

Is it possible to name the function returned by deferredGenerator 
somehow? If not, how to solve this situation? Extra problem is 
that if I add sth like 'def testSomethingWrapped(self):' calling 
generator inside, then trial will consider both testSomethign 
and testSomethingWrapped as independed test methods...




More information about the Twisted-Python mailing list