add sleep to test

This commit is contained in:
Will McGugan
2022-11-12 12:05:59 +00:00
parent b752ab5a04
commit 949745a08a
2 changed files with 4 additions and 0 deletions

View File

@@ -40,6 +40,9 @@ class Pilot:
Args: Args:
delay (float, optional): Seconds to pause. Defaults to 50ms. delay (float, optional): Seconds to pause. Defaults to 50ms.
""" """
# These sleep zeros, are to force asyncio to give up a time-slice,
# So that any pending coroutines have ran
await asyncio.sleep(0)
await asyncio.sleep(delay) await asyncio.sleep(delay)
await asyncio.sleep(0) await asyncio.sleep(0)

View File

@@ -29,6 +29,7 @@ async def test_animate_height() -> None:
assert static.size.height == 1 assert static.size.height == 1
static.styles.animate("height", 100, duration=0.5, easing="linear") static.styles.animate("height", 100, duration=0.5, easing="linear")
start = time() start = time()
# Wait for half the animation # Wait for half the animation
await pilot.pause(0.25) await pilot.pause(0.25)
# Check we reached the half way point # Check we reached the half way point