MCPcopy Index your code
hub / github.com/fabioz/PyDev.Debugger / wait_for_condition

Function wait_for_condition

tests_python/debugger_unittest.py:159–174  ·  view source on GitHub ↗
(condition, msg=None, timeout=TIMEOUT, sleep=0.05)

Source from the content-addressed store, hash-verified

157
158
159def wait_for_condition(condition, msg=None, timeout=TIMEOUT, sleep=0.05):
160 curtime = time.time()
161 while True:
162 if condition():
163 break
164 if time.time() - curtime > timeout:
165 error_msg = "Condition not reached in %s seconds" % (timeout,)
166 if msg is not None:
167 error_msg += "\n"
168 if callable(msg):
169 error_msg += msg()
170 else:
171 error_msg += str(msg)
172
173 raise TimeoutError(error_msg)
174 time.sleep(sleep)
175
176
177class IgnoreFailureError(RuntimeError):

Calls 1

TimeoutErrorClass · 0.70

Tested by

no test coverage detected