]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
fix watchlog.py doctest
authorColin Vidal <colin@isc.org>
Wed, 11 Jun 2025 13:45:52 +0000 (15:45 +0200)
committerNicki Křížek <nicki@isc.org>
Fri, 18 Jul 2025 09:32:40 +0000 (11:32 +0200)
Fix some broken doctest in watchlog.py (no semantic error, but API
slightly changed and broke some output messags). Also add a test for a
missing failure case.

bin/tests/system/isctest/log/watchlog.py

index ffa75e156df4aa353cce4d3000b6d1ff749ff8e7..3d35df09e9f89c03539a16077177158b1e367c2b 100644 (file)
@@ -76,20 +76,26 @@ class WatchLog(abc.ABC):
         ...     print("Just print something without waiting for a log line")
         Traceback (most recent call last):
           ...
-        Exception: wait_for_*() was not called
+        isctest.log.watchlog.WatchLogException: wait_for_*() was not called
 
         >>> with WatchLogFromHere("/dev/null") as watcher:
         ...     try:
-        ...         watcher.wait_for_line("foo", timeout=0)
+        ...         watcher.wait_for_line("foo", timeout=0.1)
         ...     except TimeoutError:
         ...         pass
         ...     try:
-        ...         watcher.wait_for_lines({"bar": 42}, timeout=0)
+        ...         watcher.wait_for_lines({"bar": 42}, timeout=0.1)
         ...     except TimeoutError:
         ...         pass
         Traceback (most recent call last):
           ...
-        Exception: wait_for_*() was already called
+        isctest.log.watchlog.WatchLogException: wait_for_*() was already called
+
+        >>> with WatchLogFromHere("/dev/null") as watcher:
+        ...     watcher.wait_for_line("foo", timeout=0)
+        Traceback (most recent call last):
+          ...
+        AssertionError: Do not use this class unless you want to WAIT for something.
         """
         self._fd = None  # type: Optional[TextIO]
         self._path = path