From c1e53e5eddd2c2533b7b532afd3a0d029485943e Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sat, 5 Dec 2020 21:58:42 -0500 Subject: [PATCH] Replace AsyncMock with simple mock class in FastAPI wiring tests for better compatibility --- tests/unit/wiring/test_wiringfastapi_py36.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/unit/wiring/test_wiringfastapi_py36.py b/tests/unit/wiring/test_wiringfastapi_py36.py index 0e349409..8b76d857 100644 --- a/tests/unit/wiring/test_wiringfastapi_py36.py +++ b/tests/unit/wiring/test_wiringfastapi_py36.py @@ -80,10 +80,11 @@ class WiringFastAPITest(AsyncTestCase): super().tearDown() def test_depends_marker_injection(self): - service_mock = mock.AsyncMock(spec=web.Service) - service_mock.process.return_value = 'Foo' + class ServiceMock: + async def process(self): + return 'Foo' - with web.container.service.override(service_mock): + with web.container.service.override(ServiceMock()): response = self._run(self.client.get('/')) self.assertEqual(response.status_code, 200)