Skip to content

Commit

Permalink
Add coverage for timeout waiting on a call
Browse files Browse the repository at this point in the history
  • Loading branch information
cjw296 committed Apr 20, 2023
1 parent 46a40d5 commit 22c3c60
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_hook.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from testfixtures import ShouldRaise, compare
from twisted.internet.defer import inlineCallbacks, TimeoutError
from twisted.trial.unittest import TestCase

from carly import hook, cleanup
Expand Down Expand Up @@ -27,3 +28,11 @@ def testUnconsumedCalls(self):

def testUnconsumedstr(self):
compare(str(UnconsumedCalls({})), expected='\n{}')

@inlineCallbacks
def testTimeout(self):
hook(Sample, 'method')
self.addCleanup(cleanup)
obj = Sample()
with ShouldRaise(TimeoutError):
yield obj.method.called(timeout=0.01)

0 comments on commit 22c3c60

Please sign in to comment.