[Twisted-Python] testing my application

Marcin Kasperski Marcin.Kasperski at softax.com.pl
Thu Oct 20 08:18:15 MDT 2005


> Currently I have the following problem: my test script hangs.
> Via simplification I got to the following text (requires some
> postgres database):
>
>  def setUp(self):
>      self.dbpool = adbapi.ConnectionPool('psycopg', DSN)
>      # (populating some test data)
>      deferredResult( self.dbpool.runInteraction(self._insertTestData) ) 

Hmm, replying to myself, it seems that when I changed to 

   def setUp(self):
      self.dbpool = adbapi.ConnectionPool('psycopg', DSN)
      return self.dbpool.runInteraction(self._insertTestData)

my test seems to work. Could anyone confirm that setUp (and tearDown) are also allowed to return deferreds?

I have also another problem. In fact I need to run a few deferred-returning functions within setUp. How should I join them? I can create DeferredList but will it then be checked for failures?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20051020/960cebd4/attachment.html>


More information about the Twisted-Python mailing list