Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
vytas7 authored Aug 11, 2023
2 parents e38f36d + 0c68df3 commit e2554f2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion examples/asgilook/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@ def storage_path(tmpdir_factory):

@pytest.fixture
def client(predictable_uuid, storage_path):
# NOTE(vytas): Unlike the sync FakeRedis, fakeredis.aioredis.FakeRedis
# seems to share a global state in 2.17.0 (by design or oversight).
# Make sure we initialize a new fake server for every test case.
def fake_redis_from_url(*args, **kwargs):
server = fakeredis.FakeServer()
return fakeredis.aioredis.FakeRedis(server=server)

config = Config()
config.redis_from_url = fakeredis.aioredis.FakeRedis.from_url
config.redis_from_url = fake_redis_from_url
config.redis_host = 'redis://localhost'
config.storage_path = storage_path
config.uuid_generator = predictable_uuid
Expand Down

0 comments on commit e2554f2

Please sign in to comment.