Replies: 1 comment
-
Instead of from your_app.main import YourApp
async def test_app_can_run():
app = YourApp()
async with app.run_test() as pilot:
await pilot.pause(3) To use async tests, you'll need to install [tool.pytest.ini_options]
asyncio_mode = "auto" (or it can be enabled in I also tried using from textual.pilot import Pilot
from your_app.main import YourApp
def test_app_can_run_sync():
# DON'T USE; this fails to catch errors; I don't know why.
app = YourApp()
async def auto_pilot(pilot: Pilot[object]):
await pilot.pause(3)
app.exit() # not needed with run_test
app.run(headless=True, size=(80, 24), auto_pilot=auto_pilot) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For smoke testing, I'd like to start up textual from pytest, e.g.,
However, this gives
I'd also need a way for shutting down the app after N seconds or so.
Beta Was this translation helpful? Give feedback.
All reactions