|
27 | 27 | from unittest.mock import Mock, AsyncMock
|
28 | 28 |
|
29 | 29 | import jinja2
|
30 |
| - |
31 | 30 | import qubes.tests.extra
|
32 | 31 |
|
33 | 32 | core3 = False
|
@@ -723,11 +722,9 @@ def test_010_on_qdb_change_multiple_assignments_including_full(self):
|
723 | 722 | qubesusbproxy.core3ext.USBDevice(Port(back, "1-1", "usb"))
|
724 | 723 | )
|
725 | 724 |
|
726 |
| - self.ext.attach_and_notify = Mock() |
| 725 | + self.ext.attach_and_notify = AsyncMock() |
727 | 726 | loop = asyncio.get_event_loop()
|
728 |
| - with mock.patch("asyncio.wait"): |
729 |
| - with mock.patch("asyncio.ensure_future"): |
730 |
| - loop.run_until_complete(self.ext.on_domain_start(front, None)) |
| 727 | + loop.run_until_complete(self.ext.on_domain_start(front, None)) |
731 | 728 | self.assertEqual(
|
732 | 729 | self.ext.attach_and_notify.call_args[0][1].options, {"pid": "did"}
|
733 | 730 | )
|
@@ -755,11 +752,9 @@ def test_011_on_qdb_change_multiple_assignments_port_vs_dev(self):
|
755 | 752 | qubesusbproxy.core3ext.USBDevice(Port(back, "1-1", "usb"))
|
756 | 753 | )
|
757 | 754 |
|
758 |
| - self.ext.attach_and_notify = Mock() |
| 755 | + self.ext.attach_and_notify = AsyncMock() |
759 | 756 | loop = asyncio.get_event_loop()
|
760 |
| - with mock.patch("asyncio.wait"): |
761 |
| - with mock.patch("asyncio.ensure_future"): |
762 |
| - loop.run_until_complete(self.ext.on_domain_start(front, None)) |
| 757 | + loop.run_until_complete(self.ext.on_domain_start(front, None)) |
763 | 758 | self.assertEqual(
|
764 | 759 | self.ext.attach_and_notify.call_args[0][1].options, {"pid": "any"}
|
765 | 760 | )
|
@@ -790,11 +785,9 @@ def test_012_on_qdb_change_multiple_assignments_dev(self):
|
790 | 785 | qubesusbproxy.core3ext.USBDevice(Port(back, "1-2", "usb"))
|
791 | 786 | )
|
792 | 787 |
|
793 |
| - self.ext.attach_and_notify = Mock() |
| 788 | + self.ext.attach_and_notify = AsyncMock() |
794 | 789 | loop = asyncio.get_event_loop()
|
795 |
| - with mock.patch("asyncio.wait"): |
796 |
| - with mock.patch("asyncio.ensure_future"): |
797 |
| - loop.run_until_complete(self.ext.on_domain_start(front, None)) |
| 790 | + loop.run_until_complete(self.ext.on_domain_start(front, None)) |
798 | 791 | self.assertEqual(
|
799 | 792 | self.ext.attach_and_notify.call_args[0][1].options, {"any": "did"}
|
800 | 793 | )
|
@@ -990,10 +983,9 @@ def test_023_on_startup_already_attached(self):
|
990 | 983 | front.devices["usb"]._assigned.append(assmnt)
|
991 | 984 | back.devices["usb"]._exposed.append(exp_dev)
|
992 | 985 |
|
993 |
| - self.ext.attach_and_notify = Mock() |
| 986 | + self.ext.attach_and_notify = AsyncMock() |
994 | 987 | loop = asyncio.get_event_loop()
|
995 |
| - with mock.patch("asyncio.ensure_future"): |
996 |
| - loop.run_until_complete(self.ext.on_domain_start(front, None)) |
| 988 | + loop.run_until_complete(self.ext.on_domain_start(front, None)) |
997 | 989 | self.ext.attach_and_notify.assert_not_called()
|
998 | 990 |
|
999 | 991 |
|
|
0 commit comments