Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/socketio/async_simple_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ async def call(self, event, data=None, timeout=60):
return await self.client.call(event, data,
namespace=self.namespace,
timeout=timeout)
except TimeoutError:
raise
except SocketIOError:
pass

Expand Down
2 changes: 2 additions & 0 deletions src/socketio/simple_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def call(self, event, data=None, timeout=60):
try:
return self.client.call(event, data, namespace=self.namespace,
timeout=timeout)
except TimeoutError:
raise
except SocketIOError:
pass

Expand Down
11 changes: 11 additions & 0 deletions tests/async/test_simple_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,17 @@ async def test_call_retries(self):
client.client.call.assert_awaited_with('foo', 'bar', namespace='/',
timeout=60)

async def test_call_timeout(self):
client = AsyncSimpleClient()
client.connected_event.set()
client.connected = True
client.client = mock.MagicMock()
client.client.call = mock.AsyncMock()
client.client.call.side_effect = TimeoutError()

with pytest.raises(TimeoutError):
await client.call('foo', 'bar')

async def test_receive_with_input_buffer(self):
client = AsyncSimpleClient()
client.input_buffer = ['foo', 'bar']
Expand Down
10 changes: 10 additions & 0 deletions tests/common/test_simple_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ def test_call_retries(self):
client.client.call.assert_called_with('foo', 'bar', namespace='/',
timeout=60)

def test_call_timeout(self):
client = SimpleClient()
client.connected_event.set()
client.connected = True
client.client = mock.MagicMock()
client.client.call.side_effect = TimeoutError()

with pytest.raises(TimeoutError):
client.call('foo', 'bar')

def test_receive_with_input_buffer(self):
client = SimpleClient()
client.input_buffer = ['foo', 'bar']
Expand Down