Skip to main content

setup_default_app

Setup default app for testing.

Ensures state is clean after the test returns.

def setup_default_app(
app: Application,
use_trap: boolean = False
) - > contextmanager

Setup default app for testing. Ensures state is clean after the test returns.

Parameters

NameTypeDescription
appApplicationThe application instance to be configured as the default for the duration of the context.
use_trapboolean = FalseIf true, wraps the execution within a trap context to capture or isolate application behavior.

Returns

TypeDescription
contextmanagerA context manager that restores the global application state, closes the temporary app, and cleans up finalizers upon exit.