[glib/wip/hadess/fix-assert-eventually] gio: Fix conditions in memory-monitor test
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/hadess/fix-assert-eventually] gio: Fix conditions in memory-monitor test
- Date: Mon, 6 Sep 2021 12:46:22 +0000 (UTC)
commit e1819c42fbfc13d74b9788256eeebb2455e162b0
Author: Bastien Nocera <hadess hadess net>
Date: Mon Sep 6 14:28:25 2021 +0200
gio: Fix conditions in memory-monitor test
We were lucky that this worked in some cases (the test is racy), but we
should actually run the condition check each loop, rather than when the
function is called.
Spotted by Martin Pitt:
https://github.com/GNOME/glib/commit/96a8c02d240d7c9ae366c63771291413384bdfb7#r54773831
gio/tests/memory-monitor-dbus.py.in | 4 ++--
gio/tests/memory-monitor-portal.py.in | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gio/tests/memory-monitor-dbus.py.in b/gio/tests/memory-monitor-dbus.py.in
index e8ac28faf..bf3291847 100755
--- a/gio/tests/memory-monitor-dbus.py.in
+++ b/gio/tests/memory-monitor-dbus.py.in
@@ -99,11 +99,11 @@ try:
self.dbusmock.EmitWarning(100)
# Wait 2 seconds or until warning
- self.assertEventually(self.last_warning == 100, "'100' low-memory warning not received", 20)
+ self.assertEventually(lambda: self.last_warning == 100, "'100' low-memory warning not received",
20)
self.dbusmock.EmitWarning(255)
# Wait 2 seconds or until warning
- self.assertEventually(self.last_warning == 255, "'255' low-memory warning not received", 20)
+ self.assertEventually(lambda: self.last_warning == 255, "'255' low-memory warning not received",
20)
except ImportError as e:
@unittest.skip("Cannot import %s" % e.name)
diff --git a/gio/tests/memory-monitor-portal.py.in b/gio/tests/memory-monitor-portal.py.in
index 36d5094d3..748cee850 100755
--- a/gio/tests/memory-monitor-portal.py.in
+++ b/gio/tests/memory-monitor-portal.py.in
@@ -117,11 +117,11 @@ try:
self.dbusmock.EmitWarning(100)
# Wait 2 seconds or until warning
- self.assertEventually(self.last_warning == 100, "'100' low-memory warning not received", 20)
+ self.assertEventually(lambda: self.last_warning == 100, "'100' low-memory warning not received",
20)
self.dbusmock.EmitWarning(255)
# Wait 2 seconds or until warning
- self.assertEventually(self.last_warning == 255, "'255' low-memory warning not received", 20)
+ self.assertEventually(lambda: self.last_warning == 255, "'255' low-memory warning not received",
20)
except ImportError as e:
@unittest.skip("Cannot import %s" % e.name)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]