···734 )
735 return output
736737- def wait_until_tty_matches(self, tty: str, regexp: str) -> None:
738 """Wait until the visible output on the chosen TTY matches regular
739 expression. Throws an exception on timeout.
740 """
···750 return len(matcher.findall(text)) > 0
751752 with self.nested(f"waiting for {regexp} to appear on tty {tty}"):
753- retry(tty_matches)
754755 def send_chars(self, chars: str, delay: Optional[float] = 0.01) -> None:
756 """
···762 for char in chars:
763 self.send_key(char, delay, log=False)
764765- def wait_for_file(self, filename: str) -> None:
766 """
767 Waits until the file exists in the machine's file system.
768 """
···772 return status == 0
773774 with self.nested(f"waiting for file '{filename}'"):
775- retry(check_file)
776777- def wait_for_open_port(self, port: int, addr: str = "localhost") -> None:
00778 """
779 Wait until a process is listening on the given TCP port and IP address
780 (default `localhost`).
···785 return status == 0
786787 with self.nested(f"waiting for TCP port {port} on {addr}"):
788- retry(port_is_open)
789790- def wait_for_closed_port(self, port: int, addr: str = "localhost") -> None:
00791 """
792 Wait until nobody is listening on the given TCP port and IP address
793 (default `localhost`).
···798 return status != 0
799800 with self.nested(f"waiting for TCP port {port} on {addr} to be closed"):
801- retry(port_is_closed)
802803 def start_job(self, jobname: str, user: Optional[str] = None) -> Tuple[int, str]:
804 return self.systemctl(f"start {jobname}", user)
···972 """
973 return self._get_screen_text_variants([2])[0]
974975- def wait_for_text(self, regex: str) -> None:
976 """
977 Wait until the supplied regular expressions matches the textual
978 contents of the screen by using optical character recognition (see
···995 return False
996997 with self.nested(f"waiting for {regex} to appear on screen"):
998- retry(screen_matches)
9991000 def wait_for_console_text(self, regex: str, timeout: int | None = None) -> None:
1001 """
···1146 self.send_key("ctrl-alt-delete")
1147 self.connected = False
11481149- def wait_for_x(self) -> None:
1150 """
1151 Wait until it is possible to connect to the X server.
1152 """
···1163 return status == 0
11641165 with self.nested("waiting for the X11 server"):
1166- retry(check_x)
11671168 def get_window_names(self) -> List[str]:
1169 return self.succeed(
1170 r"xwininfo -root -tree | sed 's/.*0x[0-9a-f]* \"\([^\"]*\)\".*/\1/; t; d'"
1171 ).splitlines()
11721173- def wait_for_window(self, regexp: str) -> None:
1174 """
1175 Wait until an X11 window has appeared whose name matches the given
1176 regular expression, e.g., `wait_for_window("Terminal")`.
···1188 return any(pattern.search(name) for name in names)
11891190 with self.nested("waiting for a window to appear"):
1191- retry(window_is_visible)
11921193 def sleep(self, secs: int) -> None:
1194 # We want to sleep in *guest* time, not *host* time.
···734 )
735 return output
736737+ def wait_until_tty_matches(self, tty: str, regexp: str, timeout: int = 900) -> None:
738 """Wait until the visible output on the chosen TTY matches regular
739 expression. Throws an exception on timeout.
740 """
···750 return len(matcher.findall(text)) > 0
751752 with self.nested(f"waiting for {regexp} to appear on tty {tty}"):
753+ retry(tty_matches, timeout)
754755 def send_chars(self, chars: str, delay: Optional[float] = 0.01) -> None:
756 """
···762 for char in chars:
763 self.send_key(char, delay, log=False)
764765+ def wait_for_file(self, filename: str, timeout: int = 900) -> None:
766 """
767 Waits until the file exists in the machine's file system.
768 """
···772 return status == 0
773774 with self.nested(f"waiting for file '{filename}'"):
775+ retry(check_file, timeout)
776777+ def wait_for_open_port(
778+ self, port: int, addr: str = "localhost", timeout: int = 900
779+ ) -> None:
780 """
781 Wait until a process is listening on the given TCP port and IP address
782 (default `localhost`).
···787 return status == 0
788789 with self.nested(f"waiting for TCP port {port} on {addr}"):
790+ retry(port_is_open, timeout)
791792+ def wait_for_closed_port(
793+ self, port: int, addr: str = "localhost", timeout: int = 900
794+ ) -> None:
795 """
796 Wait until nobody is listening on the given TCP port and IP address
797 (default `localhost`).
···802 return status != 0
803804 with self.nested(f"waiting for TCP port {port} on {addr} to be closed"):
805+ retry(port_is_closed, timeout)
806807 def start_job(self, jobname: str, user: Optional[str] = None) -> Tuple[int, str]:
808 return self.systemctl(f"start {jobname}", user)
···976 """
977 return self._get_screen_text_variants([2])[0]
978979+ def wait_for_text(self, regex: str, timeout: int = 900) -> None:
980 """
981 Wait until the supplied regular expressions matches the textual
982 contents of the screen by using optical character recognition (see
···999 return False
10001001 with self.nested(f"waiting for {regex} to appear on screen"):
1002+ retry(screen_matches, timeout)
10031004 def wait_for_console_text(self, regex: str, timeout: int | None = None) -> None:
1005 """
···1150 self.send_key("ctrl-alt-delete")
1151 self.connected = False
11521153+ def wait_for_x(self, timeout: int = 900) -> None:
1154 """
1155 Wait until it is possible to connect to the X server.
1156 """
···1167 return status == 0
11681169 with self.nested("waiting for the X11 server"):
1170+ retry(check_x, timeout)
11711172 def get_window_names(self) -> List[str]:
1173 return self.succeed(
1174 r"xwininfo -root -tree | sed 's/.*0x[0-9a-f]* \"\([^\"]*\)\".*/\1/; t; d'"
1175 ).splitlines()
11761177+ def wait_for_window(self, regexp: str, timeout: int = 900) -> None:
1178 """
1179 Wait until an X11 window has appeared whose name matches the given
1180 regular expression, e.g., `wait_for_window("Terminal")`.
···1192 return any(pattern.search(name) for name in names)
11931194 with self.nested("waiting for a window to appear"):
1195+ retry(window_is_visible, timeout)
11961197 def sleep(self, secs: int) -> None:
1198 # We want to sleep in *guest* time, not *host* time.