mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
add sleep to test
This commit is contained in:
@@ -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)
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user