[libvirt] [dbus PATCH] tests: Avoid hidding TimeoutError in main loop

Katerina Koukiou kkoukiou at redhat.com
Mon Apr 16 07:20:30 UTC 2018


Currently the error was not propagated from the timeout
handler properly, and we had PASSED tests even with
timeouts.

Signed-off-by: Katerina Koukiou <kkoukiou at redhat.com>
---
 test/libvirttest.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/libvirttest.py b/test/libvirttest.py
index 7168e66..d1b71cc 100644
--- a/test/libvirttest.py
+++ b/test/libvirttest.py
@@ -60,11 +60,14 @@ class BaseTestClass():
         def timeout():
             self.loop.quit()
             del self.loop
-            raise TimeoutError()
+            self.timeout = True
 
+        self.timeout = False
         self.loop = GLib.MainLoop()
         GLib.timeout_add(2000, timeout)
         self.loop.run()
+        if self.timeout:
+            raise TimeoutError()
 
     def domain(self):
         path = self.connect.ListDomains(0)[0]
-- 
2.15.0




More information about the libvir-list mailing list