19 IRONPYTHON, JYTHON, WINDOWS)
23 from .jython
import Timeout
25 from .ironpython
import Timeout
27 from .windows
import Timeout
29 from .posix
import Timeout
35 def __init__(self, timeout=None, message='', variables=None):
52 self.
stringstring = variables.replace_string(self.
stringstring)
57 self.
messagemessage = variables.replace_string(self.
messagemessage)
58 except (DataError, ValueError)
as err:
59 self.
secssecs = 0.000001
60 self.
errorerror = (
u'Setting %s timeout failed: %s'
61 % (self.type.
lower(), err))
70 elapsed = time.time() - self.
starttimestarttime
73 return round(self.
secssecs - elapsed, 3)
78 def run(self, runnable, args=None, kwargs=None):
85 test_timeout=isinstance(self, TestTimeout))
88 executable =
lambda: runnable(*(args
or ()), **(kwargs
or {}))
89 return Timeout(timeout, error).execute(executable)
93 return '%s timeout not active.' % self.type
95 return '%s timeout %s active. %s seconds left.' \
100 _timeout_error = property
105 return '%s timeout %s exceeded.' % (self.type, self.
stringstring)
111 return bool(self.
stringstring
and self.
stringstring.upper() !=
'NONE')
131 _keyword_timeout_occurred =
False
133 def __init__(self, timeout=None, message='', variables=None, rpa=False):
136 _Timeout.__init__(self, timeout, message, variables)
Used when variable does not exist.
Can be used when the core framework goes to unexpected state.
def __init__(self, timeout=None, message='', variables=None, rpa=False)
bool _keyword_timeout_occurred
def any_timeout_occurred(self)
def set_keyword_timeout(self, timeout_occurred)
def run(self, runnable, args=None, kwargs=None)
def replace_variables(self, variables)
def __init__(self, timeout=None, message='', variables=None)
def secs_to_timestr(secs, compact=False)
Converts time in seconds to a string representation.
def timestr_to_secs(timestr, round_to=3)
Parses time like '1h 10s', '01:00:10' or '42' and returns seconds.