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

Itamar Shtull-Trauring itamar at itamarst.org
Fri Apr 28 07:10:46 MDT 2006


On Fri, 2006-04-28 at 14:14 +0200, Marcin Kasperski wrote:
> 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...

I think this may be fixed in twisted 2.2.

-- 
Itamar Shtull-Trauring
http://itamarst.org






More information about the Twisted-Python mailing list