mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
test fix
This commit is contained in:
@@ -79,8 +79,6 @@ def take_svg_screenshot(
|
|||||||
if title is None:
|
if title is None:
|
||||||
title = app.title
|
title = app.title
|
||||||
|
|
||||||
svg: str | None = ""
|
|
||||||
|
|
||||||
async def auto_pilot(pilot: Pilot) -> None:
|
async def auto_pilot(pilot: Pilot) -> None:
|
||||||
app = pilot.app
|
app = pilot.app
|
||||||
await pilot.press(*press)
|
await pilot.press(*press)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
import asyncio
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
from textual.app import App
|
from textual.app import App
|
||||||
|
from textual.pilot import Pilot
|
||||||
|
|
||||||
|
|
||||||
class RefreshApp(App[float]):
|
class RefreshApp(App[float]):
|
||||||
@@ -22,7 +24,10 @@ class RefreshApp(App[float]):
|
|||||||
def test_auto_refresh():
|
def test_auto_refresh():
|
||||||
app = RefreshApp()
|
app = RefreshApp()
|
||||||
|
|
||||||
elapsed = app.run(quit_after=1, headless=True)
|
async def quit_after(pilot: Pilot) -> None:
|
||||||
|
await asyncio.sleep(1)
|
||||||
|
|
||||||
|
elapsed = app.run(auto_pilot=quit_after, headless=True)
|
||||||
assert elapsed is not None
|
assert elapsed is not None
|
||||||
# CI can run slower, so we need to give this a bit of margin
|
# CI can run slower, so we need to give this a bit of margin
|
||||||
assert 0.2 <= elapsed < 0.8
|
assert 0.2 <= elapsed < 0.8
|
||||||
|
|||||||
Reference in New Issue
Block a user