mirror of
https://github.com/ggozad/oterm.git
synced 2026-10-09 08:43:21 +02:00
wait_until returned silently after 80 iterations, so a test whose wait could never succeed carried on and passed if its later assertions happened to hold. Two such passes slipped through on this branch. It now raises TimeoutError, and the whole suite passes with it, so no existing wait depended on the give-up.
17 lines
529 B
Python
17 lines
529 B
Python
import pytest
|
|
from textual.app import App
|
|
|
|
from tests._helpers import wait_until
|
|
|
|
|
|
async def test_wait_until_raises_when_the_condition_never_holds():
|
|
async with App().run_test() as pilot:
|
|
with pytest.raises(TimeoutError):
|
|
await wait_until(pilot, lambda: False, max_iters=3)
|
|
|
|
|
|
async def test_wait_until_returns_once_the_condition_holds():
|
|
seen: list[int] = []
|
|
async with App().run_test() as pilot:
|
|
await wait_until(pilot, lambda: len(seen.append(1) or seen) >= 2)
|
|
assert len(seen) == 2
|