-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for timeouts for attach applications
Fixes #149
- Loading branch information
Jani Mikkonen
committed
Jul 3, 2019
1 parent
82de0e3
commit 4be317e
Showing
4 changed files
with
60 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import time | ||
from robot.utils import timestr_to_secs | ||
|
||
|
||
class Wait: | ||
@staticmethod | ||
def until_true(condition, timeout, error_msg): | ||
"""Helper to wait until given condition is met.""" | ||
timeout = timestr_to_secs(timeout) | ||
max_wait = time.time() + timeout | ||
while True: | ||
if condition(): | ||
break | ||
if time.time() > max_wait: | ||
raise AssertionError(error_msg) | ||
time.sleep(0.1) |