Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
test: lower time-outs for failed notification checks
Browse files Browse the repository at this point in the history
The 2 minute default time-out is unnecessary for the notification
waits, as they'll either complete in < 5 seconds, or not at all.
  • Loading branch information
bbangert committed Jul 13, 2016
1 parent fb143a9 commit ed7a69f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions autopush/tests/test_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1690,9 +1690,11 @@ def test_notification_dont_deliver_after_ack(self):

d = Deferred()

def wait_for_clear():
def wait_for_clear(count=0.0):
if self.proto.ps.updates_sent: # pragma: nocover
reactor.callLater(0.1, wait_for_clear)
if count > 5.0:
raise Exception("Time-out waiting")
reactor.callLater(0.1, wait_for_clear, count+0.1)
return

# Accepting again
Expand Down Expand Up @@ -1739,10 +1741,12 @@ def test_notification_dont_deliver(self):

d = Deferred()

def check_mock_call():
def check_mock_call(count=0.0):
calls = self.proto.process_notifications.mock_calls
if len(calls) < 1:
reactor.callLater(0.1, check_mock_call)
if count > 5.0: # pragma: nocover
raise Exception("Time-out waiting")
reactor.callLater(0.1, check_mock_call, count+0.1)
return

eq_(len(calls), 1)
Expand Down

0 comments on commit ed7a69f

Please sign in to comment.