MCPcopy
hub / github.com/Textualize/textual / run_app

Function run_app

tests/test_gc.py:22–48  ·  view source on GitHub ↗

Run a dummy app.

()

Source from the content-addressed store, hash-verified

20
21
22async def run_app() -> None:
23 """Run a dummy app."""
24
25 class DummyApp(App):
26 """Dummy app with a few widgets."""
27
28 def compose(self) -> ComposeResult:
29 yield Header()
30 with Vertical():
31 yield Label("foo")
32 yield Label("bar")
33 yield Footer()
34
35 app = DummyApp()
36
37 async with app.run_test() as pilot:
38 # We should have a bunch of DOMNodes while the test is running
39 assert count_nodes() > 0
40 await pilot.press("ctrl+c")
41
42 assert not app._running
43
44 # Force a GC collection
45 gc.collect()
46
47 # After the test, all DOMNodes will have been torn down
48 assert count_nodes() == 1
49
50
51async def _count_app_nodes() -> None:

Callers 3

run_testMethod · 0.85
runMethod · 0.85
_count_app_nodesFunction · 0.85

Calls 4

DummyAppClass · 0.85
count_nodesFunction · 0.85
run_testMethod · 0.80
pressMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…