Repository navigation
API turboframe.testing
Source: turboframe/testing/init.py. Generated from the code of TurboFrame 0.3.0 by tools/wiki_api.py.
Helpers for an application's tests (pytest and Textual's Pilot).
-
wait_for(pilot, predicate, timeout=, what=): let the app run until the predicate holds, failing aftertimeoutseconds: a bound, not a pause. -
dialog_ready(app): a TurboFrame dialog is up and takes keys (keys pressed before its focused control is mounted are lost, on a slow runner). -
isolated_config: a fixture that points the user's configuration and cache folders at temporary ones, so a test never reads or writes the user's. An application'sconftest.pysayspytest_plugins = ["turboframe.testing"]and asks for it, or wraps it in an autouse fixture of its own.
dialog_ready, isolated_config, wait_for
def dialog_ready(app) -> boolA dialog is up and takes keys: its screen is pushed, the dialog is mounted and done starting (a dialog of turboframe.ui.dialogs: its text selected), and the widget with the focus is mounted. The screen is pushed first; keys pressed before the rest are lost, or replaced when the text is selected after them.
def isolated_config(tmp_path_factory, monkeypatch)The user's configuration and cache folders (XDG on Linux and macOS, APPDATA and LOCALAPPDATA on Windows) are temporary ones; the configuration folder is returned.
A pytest fixture.
async def wait_for(pilot, predicate: Callable[[], bool], *, timeout: float = 10.0, what: str = '') -> NoneLet the app run until predicate() holds; fail after timeout seconds (a bound, not a pause).
TurboFrame · part of Divengine · GPL-3.0-or-later · report an issue
Tutorial
Examples
The desktop
- The Desktop
- Application Mixins
- Windows and Lists
- Dialogs
- Histories
- Progress
- Themes and Colors
- Glyphs
- Settings and Recent Files
- Command Palette
Editing
Tasks
Languages
Running
Reference
Links