def test_receive_runtime_err(loop): resp = ClientWebSocketResponse(mock.Mock(), mock.Mock(), mock.Mock(), mock.Mock(), 10.0, True, True, loop) resp._waiting = True with pytest.raises(RuntimeError): yield from resp.receive()
def test_receive_runtime_err(loop): resp = ClientWebSocketResponse( mock.Mock(), mock.Mock(), mock.Mock(), mock.Mock(), 10.0, True, True, loop) resp._waiting = True with pytest.raises(RuntimeError): yield from resp.receive()
def test_receive_runtime_err(self): resp = ClientWebSocketResponse(mock.Mock(), mock.Mock(), mock.Mock(), mock.Mock(), 10.0, True, True, self.loop) resp._waiting = True self.assertRaises(RuntimeError, self.loop.run_until_complete, resp.receive())
def test_receive_runtime_err(self): resp = ClientWebSocketResponse( mock.Mock(), mock.Mock(), mock.Mock(), mock.Mock(), 10.0, True, True, self.loop) resp._waiting = True self.assertRaises( RuntimeError, self.loop.run_until_complete, resp.receive())
async def _inner_messages( self, ws: aiohttp.ClientWebSocketResponse) -> AsyncIterable[str]: try: while True: msg = await asyncio.wait_for(ws.receive(), timeout=self.MESSAGE_TIMEOUT) if msg.type == aiohttp.WSMsgType.CLOSED: raise ConnectionError yield json.loads(msg.data) except asyncio.TimeoutError: return except ConnectionClosed: return except ConnectionError: return