[Twisted-Python] how to unittest the deferred

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

Hi all,

I'm newbie of Twisted. It's my first posting to this mail list. I'm
sorry for my stupid question.

Because I'm not familiar with asnyc programming, I'm suffering with
deferred. So I want to make unittest to check result easily as follow.

from twisted.trial import unittest
from twisted.internet import defer, reactor

def someFunction():
    d = defer.Deferred()
    return d

def gotValue(myExpect):
    return "result"

class SomeTest(unittest.TestCase):
    def test1(self):
        self.assertEquals('result', unittest.deferredResult(someFunction()))

But this test is not working. How can I check the "result" value.
Thanks for your kind support.


More information about the Twisted-Python mailing list