On Thu, Jul 25, 2013 at 3:25 PM, James Broadhead <jamesbroadh...@gmail.com>wrote:
> I very quickly ran into a problem where I mistakenly returned a Mock() in > the place of a deferred, causing the asserts in callbacks to not be called, > and for the test to spuriously pass. > > A slightly more believable example: > == myclass.py == > def some_function(...): > d = self.authenticate() > d.addCallback(foo) # foo never called > d.addErrback(bar) # bar never called > return d > > == test_myclass.py == > def setUp(self): > self.resource.authenticate = Mock(return_value=Mock()) > > Why not use patch and replace it with lambda: defer.succeed(None)? jml
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python