Skip to content

Commit

Permalink
tests: workaround asyncio.iscouroutinefunction(Mock)=True
Browse files Browse the repository at this point in the history
It's already fixed in Python 3.5.3, but on Travis we have Python 3.5.2.
https://bugs.python.org/issue28703
  • Loading branch information
marmarek committed Jul 4, 2017
1 parent b5ad245 commit 8318038
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions qubes/tests/api_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,7 @@ def test_480_vm_device_attach(self):
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
mock_attach = unittest.mock.Mock()
mock_attach.return_value = None
del mock_attach._is_coroutine
self.vm.add_handler('device-attach:testclass', mock_attach)
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
'is_halted', lambda _: False):
Expand All @@ -1405,6 +1406,7 @@ def test_481_vm_device_attach(self):
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
mock_attach = unittest.mock.Mock()
mock_attach.return_value = None
del mock_attach._is_coroutine
self.vm.add_handler('device-attach:testclass', mock_attach)
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
'is_halted', lambda _: False):
Expand All @@ -1420,6 +1422,7 @@ def test_481_vm_device_attach(self):
def test_482_vm_device_attach_not_running(self):
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
mock_attach = unittest.mock.Mock()
del mock_attach._is_coroutine
self.vm.add_handler('device-attach:testclass', mock_attach)
with self.assertRaises(qubes.exc.QubesVMNotRunningError):
self.call_mgmt_func(b'admin.vm.device.testclass.Attach',
Expand All @@ -1432,6 +1435,7 @@ def test_483_vm_device_attach_persistent(self):
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
mock_attach = unittest.mock.Mock()
mock_attach.return_value = None
del mock_attach._is_coroutine
self.vm.add_handler('device-attach:testclass', mock_attach)
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
'is_halted', lambda _: False):
Expand All @@ -1449,6 +1453,7 @@ def test_484_vm_device_attach_persistent_not_running(self):
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
mock_attach = unittest.mock.Mock()
mock_attach.return_value = None
del mock_attach._is_coroutine
self.vm.add_handler('device-attach:testclass', mock_attach)
value = self.call_mgmt_func(b'admin.vm.device.testclass.Attach',
b'test-vm1', b'test-vm1+1234', b'persistent=yes')
Expand All @@ -1464,6 +1469,7 @@ def test_485_vm_device_attach_options(self):
self.vm.add_handler('device-list:testclass', self.device_list_testclass)
mock_attach = unittest.mock.Mock()
mock_attach.return_value = None
del mock_attach._is_coroutine
self.vm.add_handler('device-attach:testclass', mock_attach)
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
'is_halted', lambda _: False):
Expand All @@ -1482,6 +1488,7 @@ def test_490_vm_device_detach(self):
self.device_list_attached_testclass)
mock_detach = unittest.mock.Mock()
mock_detach.return_value = None
del mock_detach._is_coroutine
self.vm.add_handler('device-detach:testclass', mock_detach)
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
'is_halted', lambda _: False):
Expand All @@ -1495,6 +1502,7 @@ def test_490_vm_device_detach(self):
def test_491_vm_device_detach_not_attached(self):
mock_detach = unittest.mock.Mock()
mock_detach.return_value = None
del mock_detach._is_coroutine
self.vm.add_handler('device-detach:testclass', mock_detach)
with unittest.mock.patch.object(qubes.vm.qubesvm.QubesVM,
'is_halted', lambda _: False):
Expand Down

0 comments on commit 8318038

Please sign in to comment.