From 49799919f1078d1bb1d8bddede552e9f1806c321 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Wed, 23 Feb 2022 16:01:39 +0100 Subject: tests: Fix wait_for_condition() again UnboundLocalError: local variable 'timeout' referenced before assignment Fixes: 9fb72c027f9119e6992771e4ce1f0a33c80d3e7c --- tests/integration-test.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/integration-test.py b/tests/integration-test.py index 4ec7f82f..3fa5f703 100755 --- a/tests/integration-test.py +++ b/tests/integration-test.py @@ -79,13 +79,12 @@ class OopTests(dbusmock.DBusTestCase): def wait_for_condition(self, condition, timeout=5): ctx = GLib.main_context_default() - timeout = timeout * 1000 + remaining = timeout * 1000 interval = 100 timed_out = False def timeout_cb(): - nonlocal timed_out - nonlocal interval - timeout = timeout - interval + nonlocal timed_out, interval, timeout + remaining = remaining - interval if timeout <= 0: timed_out = True return False -- cgit v1.2.1