Kaynağa Gözat

tests: fix already registered event impl

Frédéric Pierret (fepitre) 4 yıl önce
ebeveyn
işleme
40156c3e78
1 değiştirilmiş dosya ile 6 ekleme ve 3 silme
  1. 6 3
      qubes/tests/__init__.py

+ 6 - 3
qubes/tests/__init__.py

@@ -99,9 +99,8 @@ except libvirt.libvirtError:
 
 if in_dom0:
     import libvirtaio
-    libvirt_event_impl = libvirtaio.virEventRegisterAsyncIOImpl()
-else:
-    libvirt_event_impl = None
+
+libvirt_event_impl = None
 
 try:
     in_git = subprocess.check_output(
@@ -395,6 +394,10 @@ class QubesTestCase(unittest.TestCase):
 
         self.loop = None
 
+        global libvirt_event_impl
+
+        if in_dom0 and not libvirt_event_impl:
+            libvirt_event_impl = libvirtaio.virEventRegisterAsyncIOImpl()
 
     def __str__(self):
         return '{}/{}/{}'.format(