Skip to content

Commit

Permalink
Increase delay on each test attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobGM committed May 3, 2018
1 parent 5519bb6 commit 5cde152
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion astrality/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,19 @@ class Retry:
retries.
:param tries: Number of attempts.
:param delay: Seconds to sleep between each attempt.
:param increase_delay: Increase delay for each attempt.
"""

def __init__(
self,
tries: int = 100,
tries: int = 10,
delay: Union[int, float] = 0.1,
increase_delay: Union[int, float] = 0.3,
) -> None:
"""Retry object constructor."""
self.tries = tries
self.delay = delay
self.increase = increase_delay

def __call__(self, expression: Callable[[], Any]) -> bool:
"""
Expand All @@ -62,5 +65,6 @@ def __call__(self, expression: Callable[[], Any]) -> bool:
pass

time.sleep(self.delay)
self.delay += self.increase # type: ignore

return expression()

0 comments on commit 5cde152

Please sign in to comment.