Skip to content

Commit

Permalink
fixed conftest
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanluciano committed Nov 14, 2023
1 parent 0a6b3b0 commit ba4c8b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion arq/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def execute_command(self, *args: Union[KeyT, EncodableT], **kwargs: Any) -> 'Clu
self._command_stack.append(cmd)
return self

async def immediate_execute_command(self, cmd: PipelineCommand)-> Any:
async def immediate_execute_command(self, cmd: PipelineCommand) -> Any:
try:
return await self._client.execute_command(*cmd.args, **cmd.kwargs)
except Exception as e:
Expand Down
24 changes: 16 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import msgpack
import pytest
from redislite import Redis

from arq.connections import ArqRedis, RedisSettings, create_pool
from arq.worker import Worker
Expand All @@ -31,13 +32,10 @@ async def arq_redis(loop):


@pytest.fixture
async def arq_redis_cluster(loop):
settings = RedisSettings(host='localhost', port='6379', conn_timeout=5, cluster_mode=True)
redis_ = await create_pool(settings)
await redis_.flushall()

yield redis_
await redis_.close()
async def unix_socket_path(loop, tmp_path):
rdb = Redis(str(tmp_path / 'redis_test.db'))
yield rdb.socket_file
rdb.close()


@pytest.fixture
Expand All @@ -54,6 +52,16 @@ async def arq_redis_msgpack(loop):
await redis_.close(close_connection_pool=True)


@pytest.fixture
async def arq_redis_cluster(loop):
settings = RedisSettings(host='localhost', port='6379', conn_timeout=5, cluster_mode=True)
redis_ = await create_pool(settings)
await redis_.flushall()

yield redis_
await redis_.close()


@pytest.fixture
async def worker(arq_redis):
worker_: Worker = None
Expand Down Expand Up @@ -104,7 +112,7 @@ async def create_pool_(settings, *args, **kwargs):

yield create_pool_

await asyncio.gather(*[await p.close(close_connection_pool=True) for p in pools])
await asyncio.gather(*[p.close(close_connection_pool=True) for p in pools])


@pytest.fixture(name='cancel_remaining_task')
Expand Down

0 comments on commit ba4c8b8

Please sign in to comment.