From afd81aeca2bbd88709559a268ae941510bffee66 Mon Sep 17 00:00:00 2001 From: 9qeklajc Date: Wed, 22 Apr 2026 23:14:45 +0200 Subject: [PATCH] reduce retries --- tests/integration/test_wallet_refund.py | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/tests/integration/test_wallet_refund.py b/tests/integration/test_wallet_refund.py index 4bac88bd..c7e0b1cd 100644 --- a/tests/integration/test_wallet_refund.py +++ b/tests/integration/test_wallet_refund.py @@ -316,34 +316,21 @@ async def test_concurrent_refund_requests( assert response.status_code == 200 api_key = response.json()["api_key"] - # Create multiple concurrent refund requests - [ - { - "method": "POST", - "url": "/v1/wallet/refund", - "headers": {"Authorization": f"Bearer {api_key}"}, - } - for _ in range(5) - ] - - # Execute concurrently with exception handling + # Execute two concurrent refund requests (sufficient to test concurrency) async def refund_request(client: AsyncClient, api_key: str) -> Any: try: headers = {"Authorization": f"Bearer {api_key}"} return await client.post("/v1/wallet/refund", headers=headers) except Exception as e: - # Return a mock response for exceptions class MockResponse: status_code = 500 text = str(e) return MockResponse() - # Create tasks - tasks = [refund_request(integration_client, api_key) for _ in range(5)] + tasks = [refund_request(integration_client, api_key) for _ in range(2)] responses = await asyncio.gather(*tasks, return_exceptions=False) - # Count successes and failures successful = [ r for r in responses if hasattr(r, "status_code") and r.status_code == 200 ] @@ -351,9 +338,8 @@ async def test_concurrent_refund_requests( r for r in responses if hasattr(r, "status_code") and r.status_code != 200 ] - # At least one should succeed (the first one) assert len(successful) >= 1 - assert len(successful) + len(failed) == 5 + assert len(successful) + len(failed) == 2 @pytest.mark.integration