async def test_on_start(self, *, web): web.add_dependency = Mock(name='add_dependency') with patch('faust.web.drivers.aiohttp.ServerThread') as ServerThread: await web.on_start() ServerThread.assert_called_once_with( web, loop=web.loop, beacon=web.beacon) assert web._thread is ServerThread() web.add_dependency.assert_called_once_with(web._thread)
async def test_on_start(self, *, web): web.add_dependency = Mock(name="add_dependency") web.app.conf.web_in_thread = True with patch("faust.web.drivers.aiohttp.ServerThread") as ServerThread: await web.on_start() ServerThread.assert_called_once_with(web, loop=web.loop, beacon=web.beacon) assert web._thread is ServerThread() web.add_dependency.assert_called_once_with(web._thread)
def thread(*, web): return ServerThread(web)