WebSocket API should not overflow queue
(clientAsync)
| 199 | @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") |
| 200 | @pytest.mark.asyncio |
| 201 | async def test_ws_queue_overflow(clientAsync): |
| 202 | """WebSocket API should not overflow queue""" |
| 203 | # |
| 204 | original_size = clientAsync.ws_api.max_queue_size |
| 205 | clientAsync.ws_api.max_queue_size = 1 |
| 206 | |
| 207 | try: |
| 208 | # Request multiple order books concurrently |
| 209 | symbols = ["BTCUSDT", "ETHUSDT", "BNBUSDT"] |
| 210 | tasks = [clientAsync.ws_get_order_book(symbol=symbol) for symbol in symbols] |
| 211 | |
| 212 | # Execute all requests concurrently and wait for results |
| 213 | results = await asyncio.gather(*tasks, return_exceptions=True) |
| 214 | |
| 215 | # Check that we got valid responses or expected overflow errors |
| 216 | valid_responses = [r for r in results if not isinstance(r, Exception)] |
| 217 | assert len(valid_responses) == len(symbols), "Should get at least one valid response" |
| 218 | |
| 219 | for result in valid_responses: |
| 220 | assert_ob(result) |
| 221 | |
| 222 | finally: |
| 223 | # Restore original queue size |
| 224 | clientAsync.ws_api.MAX_QUEUE_SIZE = original_size |
| 225 | |
| 226 | |
| 227 | @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") |
nothing calls this directly
no test coverage detected
searching dependent graphs…