Skip to content

Commit

Permalink
enable changing of host for redis
Browse files Browse the repository at this point in the history
 * normally would be localhost, but enable local
   testing with a different host
 * makes it symmetric with the port definition
  • Loading branch information
JunAishima committed Feb 22, 2024
1 parent 1276164 commit 1103b37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ concurrency:

env:
FORCE_COLOR: 3
TEST_REDIS_HOST: "localhost"
TEST_REDIS_PORT: 63790

jobs:
pre-commit:
Expand Down Expand Up @@ -55,6 +57,8 @@ jobs:

- name: Start Redis
uses: supercharge/[email protected]
with:
redis-port: ${TEST_REDIS_PORT}

- name: Install package
run: python -m pip install .[test]
Expand Down
6 changes: 5 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import os
import uuid

import pytest
Expand All @@ -10,7 +11,10 @@

@pytest.fixture()
def d():
redis_client = redis.Redis(host="localhost", port=6379)
redis_client = redis.Redis(
host=os.environ.get("TEST_REDIS_HOST", "localhost"),
port=os.environ.get("TEST_REDIS_PORT", 63798),
) # use a different port than usual because are clearing it!
redis_client.flushall()
prefix = uuid.uuid4().hex
yield RedisJSONDict(redis_client, prefix=prefix)
Expand Down

0 comments on commit 1103b37

Please sign in to comment.