commit 5a14daf9b84f0c34aeac1df8bc23f8ae32817b33
parent 54552db7bad7a4f1662bca4e8c636395193f207d
Author: James Prestwood <prestwoj@gmail.com>
Date: Thu, 31 Mar 2022 16:16:33 -0700
test-runner: use may_block=True for context iteration (and move location)
This allows the callers condition to be checked immediately without
the mainloop running. In addition may_block=True allows the mainloop
to poll/sleep rather than immediately return back to the caller. This
handles async IO much better than may_block=False, at least for our
use-case.
Diffstat:
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/run-tests b/tools/run-tests
@@ -722,8 +722,6 @@ class Namespace:
context = mainloop.get_context()
while True:
- context.iteration(may_block=False)
-
try:
ret = func(*args)
if ret:
@@ -735,8 +733,6 @@ class Namespace:
GLib.source_remove(timeout)
raise e
- sleep(0.1)
-
if done.value == True:
if isinstance(exception, Exception):
raise exception
@@ -745,6 +741,8 @@ class Namespace:
else:
return
+ context.iteration(may_block=True)
+
def __str__(self):
ret = 'Namespace: %s\n' % self.name
ret += 'Processes:\n'