summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2021-02-16 17:31:02 +0100
committerBastien Nocera <hadess@hadess.net>2021-02-16 17:31:02 +0100
commit29b11f6589820e97745fe8b874372bd4c11164ba (patch)
tree89b186438cff035a08c2176932bb4725b721793f
parent77b67c702e0ae27870b3dfdf6a79344d4988d51d (diff)
downloadgnome-bluetooth-29b11f6589820e97745fe8b874372bd4c11164ba.tar.gz
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.
-rwxr-xr-xtests/integration-test5
1 files changed, 5 insertions, 0 deletions
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()