From feb8591e72b5f89c318db9550410faf7d370d4dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Thu, 12 Jan 2023 16:11:36 +0000 Subject: [PATCH 1/2] Fix test: await widget mount before focusing Follow-up to #1548 --- tests/test_input.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_input.py b/tests/test_input.py index 06f7c8b11..067c4374c 100644 --- a/tests/test_input.py +++ b/tests/test_input.py @@ -60,9 +60,9 @@ async def test_input_value_visible_if_mounted_later_and_focused(): class MyApp(App): BINDINGS = [("a", "add_input", "add_input")] - def action_add_input(self): + async def action_add_input(self): inp = Input(value="value") - self.mount(inp) + await self.mount(inp) inp.focus() app = MyApp() From 7e428e2f4ca53ff589e7e91d763794241fd2db4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Fri, 13 Jan 2023 10:58:57 +0000 Subject: [PATCH 2/2] fix tests: await all mounts. --- tests/test_input.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_input.py b/tests/test_input.py index 067c4374c..bbdb66e86 100644 --- a/tests/test_input.py +++ b/tests/test_input.py @@ -42,8 +42,8 @@ async def test_input_value_visible_if_mounted_later(): class MyApp(App): BINDINGS = [("a", "add_input", "add_input")] - def action_add_input(self): - self.mount(Input(value="value")) + async def action_add_input(self): + await self.mount(Input(value="value")) app = MyApp() async with app.run_test() as pilot: @@ -83,8 +83,8 @@ async def test_input_value_visible_if_mounted_later_and_assigned_after(): ("v", "set_value", "set_value"), ] - def action_add_input(self): - self.mount(Input()) + async def action_add_input(self): + await self.mount(Input()) def action_set_value(self): self.query_one(Input).value = "value"