diff options
| author | blasty <blasty@local> | 2026-07-10 15:05:34 +0200 |
|---|---|---|
| committer | blasty <blasty@local> | 2026-07-10 15:05:34 +0200 |
| commit | 39e4cb487e3540b45dba7fa912e60c1da9c1499b (patch) | |
| tree | 182d1cc16a2bf30a9d3ba21165888b1b86087f78 /tests | |
| parent | tests: retire the monolithic test_tui.py (superseded by test_scenarios) (diff) | |
| download | ida-tui-39e4cb487e3540b45dba7fa912e60c1da9c1499b.tar.gz ida-tui-39e4cb487e3540b45dba7fa912e60c1da9c1499b.tar.xz ida-tui-39e4cb487e3540b45dba7fa912e60c1da9c1499b.zip | |
sync: extract shared settle/wait helpers (idatui/_sync.py)
Factor the pilot suite's ad-hoc 'poll until the UI reacted' loop into one
reusable module so the upcoming RPC driver and the tests share a single
source of truth for quiescence. wait_for() takes the yield strategy
(pilot.pause vs asyncio.sleep); drain()/workers_idle()/settle() give the
live driver a 'block until quiescent, then until pred holds' primitive
built on Textual's own _wait_for_screen + the worker manager.
Ctx.wait now delegates to wait_for; suite unchanged (101 green).
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_scenarios.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/tests/test_scenarios.py b/tests/test_scenarios.py index c19bfa0..0b22f90 100644 --- a/tests/test_scenarios.py +++ b/tests/test_scenarios.py @@ -31,6 +31,7 @@ from textual.widgets import ( # noqa: E402 DataTable, Footer, Input, OptionList, Static, TextArea, ) from rich.text import Text # noqa: E402 +from idatui._sync import wait_for # noqa: E402 PASS = FAIL = 0 STOP_AFTER = None @@ -73,13 +74,7 @@ class Ctx: raise _StopSuite async def wait(self, pred, t=20.0, step=0.02): - waited = 0.0 - while waited < t: - if pred(): - return True - await self.pilot.pause(step) - waited += step - return False + return await wait_for(pred, self.pilot.pause, t, step) async def press(self, *keys): for k in keys: |
