From 4b10b9222acb0fb7e6275863d29415968b0f464e Mon Sep 17 00:00:00 2001 From: nkatha23 Date: Thu, 26 Feb 2026 16:59:47 +0300 Subject: [PATCH] fix: handle partial objects in wait_for_predicate timeout message inspect.getsource() cannot handle functools.partial objects, causing a TypeError that masks the original timeout error. Fall back to repr() if getsource fails. --- test/test_base.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/test_base.py b/test/test_base.py index 59a026256..c9febb253 100644 --- a/test/test_base.py +++ b/test/test_base.py @@ -97,9 +97,11 @@ def wait_for_predicate(self, predicate, timeout=5 * 60, interval=5): timeout -= interval import inspect - raise Exception( - f"Timed out waiting for Truth from predicate: {inspect.getsource(predicate).strip()}" - ) + try: + source = inspect.getsource(predicate).strip() + except (TypeError, OSError): + source = repr(predicate) + raise Exception(f"Timed out waiting for Truth from predicate: {source}") def get_tank(self, index): # TODO