@@ -378,8 +378,24 @@ the following
378378 the runner continues the generator, if not, the runner will wait until the
379379 condition is met with the default timeout of 4s. The result of the callable
380380 can be also retrieved from the `yield` statement. The yielded object could
381- be also a dictionary of the form `{"condition" : callable, timeout: timeout}`
382- to specify timeout in ms.
381+ also be a dictionary of the form
382+
383+ ` ` ` py
384+ {
385+ # required condition callable
386+ "condition": callable,
387+ # system timestamp when to start condition checks (default: ` time.time()`)
388+ " start_time " : timestamp,
389+ # optional the interval to invoke `condition()` (default: 17)
390+ " period " : milliseconds,
391+ # optional timeout to wait for condition to be met (default: value from unittesting.json or 4000)
392+ " timeout " : milliseconds,
393+ # optional message to print, if condition is not met within timeout
394+ " timeout_message " : " Condition not fulfilled"
395+ }
396+ ```
397+
398+ to specify various overrides such as poll interval or timeout in ms.
383399
384400- if the yielded object is an integer, say ` x ` , then it will [ continue] [ 4 ] the
385401 generator after ` x ` ms.
@@ -397,7 +413,7 @@ from unittesting import DeferrableTestCase
397413
398414class TestCondition (DeferrableTestCase ):
399415
400- def test_condition (self):
416+ def test_condition1 (self ):
401417 x = []
402418
403419 def append ():
@@ -411,6 +427,27 @@ class TestCondition(DeferrableTestCase):
411427 # wait until `condition()` is true
412428 yield condition
413429
430+ self .assertEqual(x[0 ], 1 )
431+
432+ def test_condition2 (self ):
433+ x = []
434+
435+ def append ():
436+ x.append(1 )
437+
438+ def condition ():
439+ return len (x) == 1
440+
441+ sublime.set_timeout(append, 100 )
442+
443+ # wait until `condition()` is true
444+ yield {
445+ " condition" : condition,
446+ " period" : 200 ,
447+ " timeout" : 5000 ,
448+ " timeout_message" : " Not enough items added to x"
449+ }
450+
414451 self .assertEqual(x[0 ], 1 )
415452```
416453
0 commit comments