async def test_start_server_proc(self): """ Check that the proc is started and waited for properly """ mock_event_loop = asynctest.Mock(spec = asyncio.BaseEventLoop) mock_event_loop.run_until_complete.side_effect = \ self.event_loop.run_until_complete mock_proc = asynctest.Mock(spec = asyncio.subprocess.Process) mock_proc_func = asynctest.CoroutineMock() mock_proc_func.return_value = mock_proc mock_server = asynctest.Mock(spec = Server) mock_server.server_id = 'test' mock_server.start = asynctest.CoroutineMock() mock_server.start.return_value = mock_proc_func() mock_instances = unittest.mock.MagicMock() manager = Manager( self.host, self.port, self.root, event_loop = mock_event_loop, ) manager.instances = mock_instances await manager.start_server_proc(mock_server) mock_server.start.assert_called_with() mock_proc.wait.assert_called_with() mock_instances.__setitem__.assert_called_with('test', mock_proc) mock_instances.__delitem__.assert_called_with('test')