tests: workaround asyncio.iscouroutinefunction(Mock)=True
It's already fixed in Python 3.5.3, but on Travis we have Python 3.5.2. https://bugs.python.org/issue28703
This commit is contained in:
parent
b5ad245614
commit
8318038a73
@ -1389,6 +1389,7 @@ class TC_00_VMs(AdminAPITestCase):
|
|||||||
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
|
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
|
||||||
mock_attach = unittest.mock.Mock()
|
mock_attach = unittest.mock.Mock()
|
||||||
mock_attach.return_value = None
|
mock_attach.return_value = None
|
||||||
|
del mock_attach._is_coroutine
|
||||||
self.vm.add_handler('device-attach:testclass', mock_attach)
|
self.vm.add_handler('device-attach:testclass', mock_attach)
|
||||||
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
|
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
|
||||||
'is_halted', lambda _: False):
|
'is_halted', lambda _: False):
|
||||||
@ -1405,6 +1406,7 @@ class TC_00_VMs(AdminAPITestCase):
|
|||||||
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
|
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
|
||||||
mock_attach = unittest.mock.Mock()
|
mock_attach = unittest.mock.Mock()
|
||||||
mock_attach.return_value = None
|
mock_attach.return_value = None
|
||||||
|
del mock_attach._is_coroutine
|
||||||
self.vm.add_handler('device-attach:testclass', mock_attach)
|
self.vm.add_handler('device-attach:testclass', mock_attach)
|
||||||
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
|
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
|
||||||
'is_halted', lambda _: False):
|
'is_halted', lambda _: False):
|
||||||
@ -1420,6 +1422,7 @@ class TC_00_VMs(AdminAPITestCase):
|
|||||||
def test_482_vm_device_attach_not_running(self):
|
def test_482_vm_device_attach_not_running(self):
|
||||||
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
|
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
|
||||||
mock_attach = unittest.mock.Mock()
|
mock_attach = unittest.mock.Mock()
|
||||||
|
del mock_attach._is_coroutine
|
||||||
self.vm.add_handler('device-attach:testclass', mock_attach)
|
self.vm.add_handler('device-attach:testclass', mock_attach)
|
||||||
with self.assertRaises(qubes.exc.QubesVMNotRunningError):
|
with self.assertRaises(qubes.exc.QubesVMNotRunningError):
|
||||||
self.call_mgmt_func(b'admin.vm.device.testclass.Attach',
|
self.call_mgmt_func(b'admin.vm.device.testclass.Attach',
|
||||||
@ -1432,6 +1435,7 @@ class TC_00_VMs(AdminAPITestCase):
|
|||||||
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
|
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
|
||||||
mock_attach = unittest.mock.Mock()
|
mock_attach = unittest.mock.Mock()
|
||||||
mock_attach.return_value = None
|
mock_attach.return_value = None
|
||||||
|
del mock_attach._is_coroutine
|
||||||
self.vm.add_handler('device-attach:testclass', mock_attach)
|
self.vm.add_handler('device-attach:testclass', mock_attach)
|
||||||
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
|
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
|
||||||
'is_halted', lambda _: False):
|
'is_halted', lambda _: False):
|
||||||
@ -1449,6 +1453,7 @@ class TC_00_VMs(AdminAPITestCase):
|
|||||||
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
|
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
|
||||||
mock_attach = unittest.mock.Mock()
|
mock_attach = unittest.mock.Mock()
|
||||||
mock_attach.return_value = None
|
mock_attach.return_value = None
|
||||||
|
del mock_attach._is_coroutine
|
||||||
self.vm.add_handler('device-attach:testclass', mock_attach)
|
self.vm.add_handler('device-attach:testclass', mock_attach)
|
||||||
value = self.call_mgmt_func(b'admin.vm.device.testclass.Attach',
|
value = self.call_mgmt_func(b'admin.vm.device.testclass.Attach',
|
||||||
b'test-vm1', b'test-vm1+1234', b'persistent=yes')
|
b'test-vm1', b'test-vm1+1234', b'persistent=yes')
|
||||||
@ -1464,6 +1469,7 @@ class TC_00_VMs(AdminAPITestCase):
|
|||||||
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
|
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
|
||||||
mock_attach = unittest.mock.Mock()
|
mock_attach = unittest.mock.Mock()
|
||||||
mock_attach.return_value = None
|
mock_attach.return_value = None
|
||||||
|
del mock_attach._is_coroutine
|
||||||
self.vm.add_handler('device-attach:testclass', mock_attach)
|
self.vm.add_handler('device-attach:testclass', mock_attach)
|
||||||
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
|
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
|
||||||
'is_halted', lambda _: False):
|
'is_halted', lambda _: False):
|
||||||
@ -1482,6 +1488,7 @@ class TC_00_VMs(AdminAPITestCase):
|
|||||||
self.device_list_attached_testclass)
|
self.device_list_attached_testclass)
|
||||||
mock_detach = unittest.mock.Mock()
|
mock_detach = unittest.mock.Mock()
|
||||||
mock_detach.return_value = None
|
mock_detach.return_value = None
|
||||||
|
del mock_detach._is_coroutine
|
||||||
self.vm.add_handler('device-detach:testclass', mock_detach)
|
self.vm.add_handler('device-detach:testclass', mock_detach)
|
||||||
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
|
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
|
||||||
'is_halted', lambda _: False):
|
'is_halted', lambda _: False):
|
||||||
@ -1495,6 +1502,7 @@ class TC_00_VMs(AdminAPITestCase):
|
|||||||
def test_491_vm_device_detach_not_attached(self):
|
def test_491_vm_device_detach_not_attached(self):
|
||||||
mock_detach = unittest.mock.Mock()
|
mock_detach = unittest.mock.Mock()
|
||||||
mock_detach.return_value = None
|
mock_detach.return_value = None
|
||||||
|
del mock_detach._is_coroutine
|
||||||
self.vm.add_handler('device-detach:testclass', mock_detach)
|
self.vm.add_handler('device-detach:testclass', mock_detach)
|
||||||
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
|
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
|
||||||
'is_halted', lambda _: False):
|
'is_halted', lambda _: False):
|
||||||
|
Loading…
Reference in New Issue
Block a user