From 2afb3755b2ceb7066ce112e8f01c39cee27c02d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicki=20K=C5=99=C3=AD=C5=BEek?= Date: Mon, 23 Jun 2025 14:24:34 +0200 Subject: [PATCH] Allow WatchLog.wait_for_line() to be called more than once In some cases, it can be useful to be able to re-use the same WatchLog to wait for another line. --- bin/tests/system/isctest/log/watchlog.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/bin/tests/system/isctest/log/watchlog.py b/bin/tests/system/isctest/log/watchlog.py index 9bdcecd8ab..467a935ebc 100644 --- a/bin/tests/system/isctest/log/watchlog.py +++ b/bin/tests/system/isctest/log/watchlog.py @@ -77,7 +77,7 @@ class WatchLog(abc.ABC): `timeout` is the number of seconds (float) to wait for each wait call. Every instance of this class must call one of the `wait_for_*()` - methods exactly once or else an `Exception` is thrown. + methods at least once or else an `Exception` is thrown. >>> with WatchLogFromStart("/dev/null") as watcher: ... print("Just print something without waiting for a log line") @@ -85,19 +85,6 @@ class WatchLog(abc.ABC): ... isctest.log.watchlog.WatchLogException: wait_for_*() was not called - >>> with WatchLogFromHere("/dev/null", timeout=0.1) as watcher: - ... try: - ... watcher.wait_for_line("foo") - ... except TimeoutError: - ... pass - ... try: - ... watcher.wait_for_lines({"bar": 42}) - ... except TimeoutError: - ... pass - Traceback (most recent call last): - ... - isctest.log.watchlog.WatchLogException: wait_for_*() was already called - >>> with WatchLogFromHere("/dev/null", timeout=0.0) as watcher: ... watcher.wait_for_line("foo") Traceback (most recent call last): @@ -262,9 +249,6 @@ class WatchLog(abc.ABC): qux """ regexes = self._prepare_patterns(patterns) - - if self._wait_function_called: - raise WatchLogException("wait_for_*() was already called") self._wait_function_called = True deadline = time.monotonic() + self._timeout