[gnome-bluetooth/wip/hadess/more-tests: 1/4] tests: Add wait_for_condition() helper
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/wip/hadess/more-tests: 1/4] tests: Add wait_for_condition() helper
- Date: Tue, 16 Feb 2021 16:38:20 +0000 (UTC)
commit 29b11f6589820e97745fe8b874372bd4c11164ba
Author: Bastien Nocera <hadess hadess net>
Date: Tue Feb 16 17:31:02 2021 +0100
tests: Add wait_for_condition() helper
Rather than using a static timeout which we could go over if tests
taking longer to run, or CI is slower than expected.
tests/integration-test | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/tests/integration-test b/tests/integration-test
index 50b1cdcb..1589723e 100755
--- a/tests/integration-test
+++ b/tests/integration-test
@@ -71,6 +71,11 @@ class OopTests(dbusmock.DBusTestCase):
GLib.timeout_add_seconds(1, ml.quit)
ml.run()
+ def wait_for_condition(self, condition):
+ ctx = GLib.main_context_default()
+ while not condition():
+ ctx.iteration(True)
+
def test_no_adapters(self):
adapters = self.client.get_adapter_model()
self.wait_for_mainloop()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]