diff --git a/qubesadmin/tests/tools/qvm_backup.py b/qubesadmin/tests/tools/qvm_backup.py index cc2b5d6..20634df 100644 --- a/qubesadmin/tests/tools/qvm_backup.py +++ b/qubesadmin/tests/tools/qvm_backup.py @@ -22,6 +22,7 @@ import os import unittest.mock as mock import asyncio +import asynctest import qubesadmin.tests import qubesadmin.tests.tools @@ -177,9 +178,11 @@ class TC_00_qvm_backup(qubesadmin.tests.QubesTestCase): None)] = \ b'0\0' try: + mock_events = asynctest.CoroutineMock() patch = mock.patch( - 'qubesadmin.events.EventsDispatcher._get_events_reader') - mock_events = patch.start() + 'qubesadmin.events.EventsDispatcher._get_events_reader', + mock_events) + patch.start() self.addCleanup(patch.stop) mock_events.side_effect = qubesadmin.tests.tools.MockEventsReader([ b'1\0\0connection-established\0\0', diff --git a/qubesadmin/tests/tools/qvm_shutdown.py b/qubesadmin/tests/tools/qvm_shutdown.py index c7dc732..963a303 100644 --- a/qubesadmin/tests/tools/qvm_shutdown.py +++ b/qubesadmin/tests/tools/qvm_shutdown.py @@ -18,7 +18,9 @@ # You should have received a copy of the GNU Lesser General Public License along # with this program; if not, see . import asyncio +import asynctest import unittest.mock + import qubesadmin.tests import qubesadmin.tests.tools import qubesadmin.tools.qvm_shutdown @@ -85,9 +87,11 @@ class TC_00_qvm_shutdown(qubesadmin.tests.QubesTestCase): loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + mock_events = asynctest.CoroutineMock() patch = unittest.mock.patch( - 'qubesadmin.events.EventsDispatcher._get_events_reader') - mock_events = patch.start() + 'qubesadmin.events.EventsDispatcher._get_events_reader', + mock_events) + patch.start() self.addCleanup(patch.stop) mock_events.side_effect = qubesadmin.tests.tools.MockEventsReader([ b'1\0\0connection-established\0\0', @@ -114,9 +118,11 @@ class TC_00_qvm_shutdown(qubesadmin.tests.QubesTestCase): loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + mock_events = asynctest.CoroutineMock() patch = unittest.mock.patch( - 'qubesadmin.events.EventsDispatcher._get_events_reader') - mock_events = patch.start() + 'qubesadmin.events.EventsDispatcher._get_events_reader', + mock_events) + patch.start() self.addCleanup(patch.stop) mock_events.side_effect = qubesadmin.tests.tools.MockEventsReader([ b'1\0\0connection-established\0\0', @@ -159,9 +165,11 @@ class TC_00_qvm_shutdown(qubesadmin.tests.QubesTestCase): loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) + mock_events = asynctest.CoroutineMock() patch = unittest.mock.patch( - 'qubesadmin.events.EventsDispatcher._get_events_reader') - mock_events = patch.start() + 'qubesadmin.events.EventsDispatcher._get_events_reader', + mock_events) + patch.start() self.addCleanup(patch.stop) mock_events.side_effect = qubesadmin.tests.tools.MockEventsReader([ b'1\0\0connection-established\0\0',