diff --git a/tests/test_invoke.py b/tests/test_invoke.py index 1e420030..4298e3a9 100644 --- a/tests/test_invoke.py +++ b/tests/test_invoke.py @@ -614,8 +614,10 @@ class SM(StateChart): done_invoke_loading = loading.to(ready) sm = await sm_runner.start(SM) - await sm_runner.sleep(0.15) - await sm_runner.processing_loop(sm) + deadline = time.monotonic() + 2.0 + while "ready" not in sm.configuration_values and time.monotonic() < deadline: + await sm_runner.sleep(0.02) + await sm_runner.processing_loop(sm) assert "ready" in sm.configuration_values # All invocations should be terminated by now