|
25 | 25 | import re
|
26 | 26 | import asyncio
|
27 | 27 |
|
28 |
| -import asynctest |
29 |
| - |
30 | 28 | import qubesadmin.tests
|
31 | 29 | import qubesadmin.tools.qvm_start_daemon
|
32 | 30 | from qubesadmin.tools.qvm_start_daemon import GUI_DAEMON_OPTIONS
|
@@ -208,7 +206,7 @@ def test_013_common_args_guid_config(self):
|
208 | 206 | }
|
209 | 207 | ''')
|
210 | 208 |
|
211 |
| - @asynctest.patch('asyncio.create_subprocess_exec') |
| 209 | + @unittest.mock.patch('asyncio.create_subprocess_exec') |
212 | 210 | def test_020_start_gui_for_vm(self, proc_mock):
|
213 | 211 | loop = asyncio.new_event_loop()
|
214 | 212 | asyncio.set_event_loop(loop)
|
@@ -243,7 +241,7 @@ def test_020_start_gui_for_vm(self, proc_mock):
|
243 | 241 |
|
244 | 242 | self.assertAllCalled()
|
245 | 243 |
|
246 |
| - @asynctest.patch('asyncio.create_subprocess_exec') |
| 244 | + @unittest.mock.patch('asyncio.create_subprocess_exec') |
247 | 245 | def test_021_start_gui_for_vm_hvm(self, proc_mock):
|
248 | 246 | loop = asyncio.new_event_loop()
|
249 | 247 | asyncio.set_event_loop(loop)
|
@@ -316,7 +314,7 @@ def test_022_start_gui_for_vm_hvm_stubdom(self):
|
316 | 314 | pidfile.flush()
|
317 | 315 | self.addCleanup(pidfile.close)
|
318 | 316 |
|
319 |
| - patch_proc = asynctest.patch('asyncio.create_subprocess_exec') |
| 317 | + patch_proc = unittest.mock.patch('asyncio.create_subprocess_exec') |
320 | 318 | patch_monitor_layout = unittest.mock.patch.object(
|
321 | 319 | qubesadmin.tools.qvm_start_daemon,
|
322 | 320 | 'get_monitor_layout',
|
@@ -363,10 +361,7 @@ def test_030_start_gui_for_stubdomain(self):
|
363 | 361 | ('test-vm', 'admin.vm.feature.CheckWithTemplate', 'gui-emulated',
|
364 | 362 | None)] = \
|
365 | 363 | b'2\x00QubesFeatureNotFoundError\x00\x00Feature not set\x00'
|
366 |
| - proc_mock = unittest.mock.Mock() |
367 |
| - with asynctest.patch('asyncio.create_subprocess_exec', |
368 |
| - lambda *args: self.mock_coroutine(proc_mock, |
369 |
| - *args)): |
| 364 | + with unittest.mock.patch('asyncio.create_subprocess_exec') as proc_mock: |
370 | 365 | with unittest.mock.patch.object(self.launcher,
|
371 | 366 | 'common_guid_args', lambda vm: []):
|
372 | 367 | loop.run_until_complete(self.launcher.start_gui_for_stubdomain(
|
@@ -397,10 +392,7 @@ def test_031_start_gui_for_stubdomain_forced(self):
|
397 | 392 | ('test-vm', 'admin.vm.feature.CheckWithTemplate', 'gui-emulated',
|
398 | 393 | None)] = \
|
399 | 394 | b'0\x001'
|
400 |
| - proc_mock = unittest.mock.Mock() |
401 |
| - with asynctest.patch('asyncio.create_subprocess_exec', |
402 |
| - lambda *args: self.mock_coroutine(proc_mock, |
403 |
| - *args)): |
| 395 | + with unittest.mock.patch('asyncio.create_subprocess_exec') as proc_mock: |
404 | 396 | with unittest.mock.patch.object(self.launcher,
|
405 | 397 | 'common_guid_args', lambda vm: []):
|
406 | 398 | loop.run_until_complete(self.launcher.start_gui_for_stubdomain(
|
|
0 commit comments