diff --git a/gio/tests/memory-monitor-dbus.py.in b/gio/tests/memory-monitor-dbus.py.in index 89906f482..43c6c63fd 100755 --- a/gio/tests/memory-monitor-dbus.py.in +++ b/gio/tests/memory-monitor-dbus.py.in @@ -75,7 +75,7 @@ class TestLowMemoryMonitor(dbusmock.DBusTestCase): self.dbusmock.EmitWarning(100) # Wait 2 seconds or until warning timeout = 2 - while timeout > 0 or self.last_warning != 100: + while timeout > 0 and self.last_warning != 100: time.sleep(0.5) timeout -= 0.5 self.main_context.iteration(False) @@ -84,7 +84,7 @@ class TestLowMemoryMonitor(dbusmock.DBusTestCase): self.dbusmock.EmitWarning(255) # Wait 2 seconds or until warning timeout = 2 - while timeout > 0 or self.last_warning != 255: + while timeout > 0 and self.last_warning != 255: time.sleep(0.5) timeout -= 0.5 self.main_context.iteration(False) diff --git a/gio/tests/memory-monitor-portal.py.in b/gio/tests/memory-monitor-portal.py.in index ae6d59d12..8572d8f69 100755 --- a/gio/tests/memory-monitor-portal.py.in +++ b/gio/tests/memory-monitor-portal.py.in @@ -91,7 +91,7 @@ class TestLowMemoryMonitorPortal(dbusmock.DBusTestCase): self.dbusmock.EmitWarning(100) # Wait 2 seconds or until warning timeout = 2 - while timeout > 0 or self.last_warning != 100: + while timeout > 0 and self.last_warning != 100: time.sleep(0.5) timeout -= 0.5 self.main_context.iteration(False) @@ -100,7 +100,7 @@ class TestLowMemoryMonitorPortal(dbusmock.DBusTestCase): self.dbusmock.EmitWarning(255) # Wait 2 seconds or until warning timeout = 2 - while timeout > 0 or self.last_warning != 255: + while timeout > 0 and self.last_warning != 255: time.sleep(0.5) timeout -= 0.5 self.main_context.iteration(False)