Skip to content

Commit 7536d6a

Browse files
committed
tests
1 parent 91fd712 commit 7536d6a

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

src/textual/drivers/linux_inline_driver.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ def stop_application_mode(self) -> None:
315315
self.disable_input()
316316
self.write("\x1b[<u") # Disable kitty protocol
317317
self.write("\x1b[J")
318-
self.flush()
319318

320319
if self.attrs_before is not None:
321320
try:

tests/test_app.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from rich.terminal_theme import DIMMED_MONOKAI, MONOKAI, NIGHT_OWLISH
44

55
from textual.app import App, ComposeResult
6-
from textual.widgets import Button, Input
6+
from textual.widgets import Button, Input, Static
77

88

99
def test_batch_update():
@@ -140,3 +140,36 @@ async def test_ansi_theme():
140140

141141
app.dark = True
142142
assert app.ansi_theme == DIMMED_MONOKAI
143+
144+
145+
async def test_early_exit():
146+
"""Test exiting early doesn't cause issues."""
147+
from textual.app import App
148+
149+
class AppExit(App):
150+
def compose(self):
151+
yield Static("Hello")
152+
153+
def on_mount(self) -> None:
154+
# Exit after creating app
155+
self.exit()
156+
157+
app = AppExit()
158+
async with app.run_test():
159+
pass
160+
161+
162+
def test_early_exit_inline():
163+
"""Test exiting early in inline mode doesn't break."""
164+
from textual.app import App
165+
166+
class AppExit(App):
167+
def compose(self):
168+
yield Static("Hello")
169+
170+
def on_mount(self) -> None:
171+
# Exit after creating app
172+
self.exit()
173+
174+
app = AppExit()
175+
app.run(inline=True, inline_no_clear=True)

0 commit comments

Comments
 (0)