Skip to content

Commit

Permalink
speedup test
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Aug 23, 2022
1 parent 3ff25ad commit 2eab750
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import re
import sys
from datetime import timedelta

import pytest
Expand Down Expand Up @@ -33,10 +34,14 @@ async def test_redis_timeout(mocker, create_pool):

async def test_redis_timeout_and_retry_many_times(mocker, create_pool):
mocker.spy(arq.utils.asyncio, 'sleep')
retry_count = 2000
with pytest.raises(ConnectionError):
await create_pool(RedisSettings(port=0, conn_retry_delay=0, conn_retries=retry_count))
assert arq.utils.asyncio.sleep.call_count == retry_count
default_recursion_limit = sys.getrecursionlimit()
sys.setrecursionlimit(100)
try:
with pytest.raises(ConnectionError):
await create_pool(RedisSettings(port=0, conn_retry_delay=0, conn_retries=150))
assert arq.utils.asyncio.sleep.call_count == 150
finally:
sys.setrecursionlimit(default_recursion_limit)


@pytest.mark.skip(reason='this breaks many other tests as low level connections remain after failed connection')
Expand Down

0 comments on commit 2eab750

Please sign in to comment.