summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-05-28 11:49:23 +0000
committerLily Foster <lily@lily.flowers>2023-06-15 14:59:47 -0400
commit1616bfbde76a645a12c6ea4208af2f60e39abbfa (patch)
tree624ef0a4b81be7ee519362b9fe93362f11e78de9
parentnixos/test-driver: add `timeout` option for `wait_for_console_text` (variant 2) (diff)
downloadnixpkgs-origin/backport-234513-to-release-23.05.tar.gz
nixos/test-driver: fix formattingorigin/backport-234513-to-release-23.05
This caused the test driver to fail to build. Fixes: 406de94b416 ("nixos/test-driver: add `timeout` option for `wait_for_console_text`")
-rw-r--r--nixos/lib/test-driver/test_driver/machine.py11
1 files 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 3673271798a8..1d1d5bef9bf4 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: