mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
fix deadlock on tests
This commit is contained in:
@@ -189,9 +189,12 @@ class Animator:
|
||||
async def stop(self) -> None:
|
||||
"""Stop the animator task."""
|
||||
try:
|
||||
await self._timer.stop()
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
try:
|
||||
await self._timer.stop()
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
finally:
|
||||
self._idle_event.set()
|
||||
|
||||
def bind(self, obj: object) -> BoundAnimator:
|
||||
"""Bind the animator to a given objects."""
|
||||
|
||||
@@ -803,9 +803,11 @@ class App(Generic[ReturnType], DOMNode):
|
||||
terminal_size=size,
|
||||
)
|
||||
finally:
|
||||
if auto_pilot_task is not None:
|
||||
await auto_pilot_task
|
||||
await app._shutdown()
|
||||
try:
|
||||
if auto_pilot_task is not None:
|
||||
await auto_pilot_task
|
||||
finally:
|
||||
await app._shutdown()
|
||||
|
||||
return app.return_value
|
||||
|
||||
@@ -1291,6 +1293,10 @@ class App(Generic[ReturnType], DOMNode):
|
||||
|
||||
await self.animator.start()
|
||||
|
||||
except Exception:
|
||||
await self.animator.stop()
|
||||
raise
|
||||
|
||||
finally:
|
||||
await self._ready()
|
||||
await invoke_ready_callback()
|
||||
@@ -1303,10 +1309,11 @@ class App(Generic[ReturnType], DOMNode):
|
||||
pass
|
||||
finally:
|
||||
self._running = False
|
||||
for timer in list(self._timers):
|
||||
await timer.stop()
|
||||
|
||||
await self.animator.stop()
|
||||
try:
|
||||
await self.animator.stop()
|
||||
finally:
|
||||
for timer in list(self._timers):
|
||||
await timer.stop()
|
||||
|
||||
self._running = True
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user