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

Katerina Koukiou posted 1 patch 6 years ago
Failed in applying to current master (apply log)
test/libvirttest.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
[libvirt] [dbus PATCH] tests: Avoid hidding TimeoutError in main loop
Posted by Katerina Koukiou 6 years ago
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@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH] tests: Avoid hidding TimeoutError in main loop
Posted by Ján Tomko 6 years ago
On Mon, Apr 16, 2018 at 09:20:30AM +0200, Katerina Koukiou wrote:
>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@redhat.com>
>---
> test/libvirttest.py | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list