nixos/test-driver: fix formatting
This caused the test driver to fail to build.
Fixes: 406de94b41
("nixos/test-driver: add `timeout` option for `wait_for_console_text`")
This commit is contained in:
parent
05c30cbde3
commit
507ff39251
|
@ -857,16 +857,17 @@ class Machine:
|
||||||
|
|
||||||
def wait_for_console_text(self, regex: str, timeout: int | None = None) -> None:
|
def wait_for_console_text(self, regex: str, timeout: int | None = None) -> None:
|
||||||
"""
|
"""
|
||||||
Wait for the provided regex to appear on console.
|
Wait for the provided regex to appear on console.
|
||||||
For each reads,
|
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
|
# Buffer the console output, this is needed
|
||||||
# to match multiline regexes.
|
# to match multiline regexes.
|
||||||
console = io.StringIO()
|
console = io.StringIO()
|
||||||
|
|
||||||
def console_matches() -> bool:
|
def console_matches() -> bool:
|
||||||
nonlocal console
|
nonlocal console
|
||||||
try:
|
try:
|
||||||
|
@ -877,7 +878,7 @@ class Machine:
|
||||||
pass
|
pass
|
||||||
console.seek(0)
|
console.seek(0)
|
||||||
matches = re.search(regex, console.read())
|
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"):
|
with self.nested(f"waiting for {regex} to appear on console"):
|
||||||
if timeout is not None:
|
if timeout is not None:
|
||||||
|
|
Loading…
Reference in a new issue