[Twisted-Python] how to unittest the deferred

Hyungyong Kim yong27 at gmail.com
Wed Sep 28 21:59:43 EDT 2005


Thanks for your answer.

But, in this case, any values are OK. Try to test that after replace
'result' to 'aaa'. I'm testing it using "trial" command.

2005/9/29, Jp Calderone <exarkun at divmod.com>:
> I'm not entirely certain why the above doesn't work, although I could make some good guesses.  Here's the preferred way to write such a test:
>
>     class SomeTest(unittest.TestCase):
>         def test1(self):
>             d = someFunction()
>             d.addCallack(self.assertEquals, 'result')
>             return d
>
> Jp
>

How can I test that. In my real code, someFunction returns deferred
from DB connection.




More information about the Twisted-Python mailing list