From 507ff392516c1885e55cb9a5c42b1966932d503b Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 28 May 2023 11:49:23 +0000 Subject: [PATCH] nixos/test-driver: fix formatting This caused the test driver to fail to build. Fixes: 406de94b416 ("nixos/test-driver: add `timeout` option for `wait_for_console_text`") --- nixos/lib/test-driver/test_driver/machine.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nixos/lib/test-driver/test_driver/machine.py b/nixos/lib/test-driver/test_driver/machine.py index 3673271798a..1d1d5bef9bf 100644 --- a/nixos/lib/test-driver/test_driver/machine.py +++ b/nixos/lib/test-driver/test_driver/machine.py @@ -857,16 +857,17 @@ class Machine: def wait_for_console_text(self, regex: str, timeout: int | None = None) -> None: """ - Wait for the provided regex to appear on console. - For each reads, + Wait for the provided regex to appear on console. + For each reads, - If timeout is None, timeout is infinite. + If timeout is None, timeout is infinite. - `timeout` is in seconds. + `timeout` is in seconds. """ # Buffer the console output, this is needed # to match multiline regexes. console = io.StringIO() + def console_matches() -> bool: nonlocal console try: @@ -877,7 +878,7 @@ class Machine: pass console.seek(0) matches = re.search(regex, console.read()) - return (matches is not None) + return matches is not None with self.nested(f"waiting for {regex} to appear on console"): if timeout is not None: