[CalendarServer-changes] [9574] CalendarServer/branches/users/glyph/q

source_changes at macosforge.org source_changes at macosforge.org
Sat Aug 11 01:54:21 PDT 2012


Revision: 9574
          http://trac.macosforge.org/projects/calendarserver/changeset/9574
Author:   glyph at apple.com
Date:     2012-08-11 01:54:20 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
nicer looking traceback output in the case of a failure

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/q/twext/enterprise/test/test_adbapi2.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/q/

Modified: CalendarServer/branches/users/glyph/q/twext/enterprise/test/test_adbapi2.py
===================================================================
--- CalendarServer/branches/users/glyph/q/twext/enterprise/test/test_adbapi2.py	2012-08-11 08:54:20 UTC (rev 9573)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/test/test_adbapi2.py	2012-08-11 08:54:20 UTC (rev 9574)
@@ -25,6 +25,7 @@
 from zope.interface.declarations import implements
 
 from twisted.python.threadpool import ThreadPool
+from twisted.python.failure import Failure
 
 from twisted.trial.unittest import TestCase
 
@@ -669,12 +670,22 @@
         self.pool.stopService().addBoth(stopd.append)
         self.assertEquals(stopd, [])
         self.flushHolders()
-        self.assertEquals(stopd, [None])
+        self.assertResultList(stopd, None)
         [holder] = self.holders
         self.assertEquals(holder.started, True)
         self.assertEquals(holder.stopped, True)
 
 
+    def assertResultList(self, resultList, expected):
+        if not resultList:
+            self.fail("No result; Deferred didn't fire yet.")
+        else:
+            if isinstance(resultList[0], Failure):
+                resultList[0].raiseException()
+            else:
+                self.assertEqual(resultList, [expected])
+
+
     def test_shutdownDuringAttemptFailed(self):
         """
         If L{ConnectionPool.stopService} is called while a connection attempt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/a22c1cf6/attachment.html>


More information about the calendarserver-changes mailing list