From b78ad1993c679eb48a0c51446ebcf0afad24e68d Mon Sep 17 00:00:00 2001 From: Wojtek Porczyk Date: Thu, 21 Sep 2017 14:17:36 +0200 Subject: [PATCH] qubes/tests: do not deadlock on .drain() --- qubes/tests/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qubes/tests/__init__.py b/qubes/tests/__init__.py index 81158a49..cb517b6c 100644 --- a/qubes/tests/__init__.py +++ b/qubes/tests/__init__.py @@ -410,7 +410,11 @@ class QubesTestCase(unittest.TestCase): # Check for unfinished libvirt business. if libvirt_event_impl is not None: - self.loop.run_until_complete(libvirt_event_impl.drain()) + try: + self.loop.run_until_complete(asyncio.wait_for( + libvirt_event_impl.drain(), timeout=4)) + except asyncio.TimeoutError: + raise AssertionError('libvirt event impl drain timeout') # Check there are no Tasks left. assert not self.loop._ready