From 75e339b54c5bd1656f2e7cbbfc1a6f85529f24c1 Mon Sep 17 00:00:00 2001 From: Benjamin Braatz Date: Sun, 21 Mar 2021 17:35:30 +0100 Subject: [PATCH] Add wait parameter to test function. --- controlpi/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/controlpi/__init__.py b/controlpi/__init__.py index 658b775..227672b 100644 --- a/controlpi/__init__.py +++ b/controlpi/__init__.py @@ -94,7 +94,8 @@ async def run(conf: Dict[str, PluginConf]) -> None: async def test(conf: Dict[str, PluginConf], - messages: List[Dict[str, Any]]) -> None: + messages: List[Dict[str, Any]], + wait: float = 0.0) -> None: """Test configuration of ControlPi system. Setup message bus, process given configuration, run message bus and @@ -170,4 +171,5 @@ async def test(conf: Dict[str, PluginConf], await message_bus.send(Message('test()', message)) # Give immediate reactions to messages opportunity to happen: await asyncio.sleep(0) + await asyncio.sleep(wait) await message_bus._queue.join() -- 2.34.1