pyupgrade fixed imports
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
"""Integration tests configuration."""
|
"""Integration tests configuration."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from typing import Generator
|
from collections.abc import Generator
|
||||||
import pytest
|
import pytest
|
||||||
import redis
|
import redis
|
||||||
import structlog
|
import structlog
|
||||||
@@ -27,7 +27,7 @@ def configure_logging() -> None:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def redis_container() -> Generator[str, None, None]:
|
def redis_container() -> Generator[str]:
|
||||||
"""Set up a Redis container for testing and yield the Redis URI."""
|
"""Set up a Redis container for testing and yield the Redis URI."""
|
||||||
# Start container
|
# Start container
|
||||||
container = RedisContainer(
|
container = RedisContainer(
|
||||||
@@ -52,7 +52,7 @@ def redis_container() -> Generator[str, None, None]:
|
|||||||
@pytest.fixture(scope="session", autouse=True)
|
@pytest.fixture(scope="session", autouse=True)
|
||||||
def set_environment_variables(
|
def set_environment_variables(
|
||||||
redis_container: str,
|
redis_container: str,
|
||||||
) -> Generator[dict[str, str], None, None]:
|
) -> Generator[dict[str, str]]:
|
||||||
"""Set environment variables needed for tests."""
|
"""Set environment variables needed for tests."""
|
||||||
# Build environment variables dictionary
|
# Build environment variables dictionary
|
||||||
env_vars = {"REDIS_URI": redis_container}
|
env_vars = {"REDIS_URI": redis_container}
|
||||||
@@ -68,7 +68,7 @@ def set_environment_variables(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def raw_redis_client(redis_container: str) -> Generator[redis.Redis, None, None]:
|
def raw_redis_client(redis_container: str) -> Generator[redis.Redis]:
|
||||||
"""Provide a raw Redis client connected to the test Redis container."""
|
"""Provide a raw Redis client connected to the test Redis container."""
|
||||||
# Connect client
|
# Connect client
|
||||||
client = redis.Redis.from_url(
|
client = redis.Redis.from_url(
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# allowing tests to access RedisAdapter's internal methods as needed for integration testing.
|
# allowing tests to access RedisAdapter's internal methods as needed for integration testing.
|
||||||
"""Integration tests for the RedisAdapter."""
|
"""Integration tests for the RedisAdapter."""
|
||||||
|
|
||||||
from typing import Generator
|
from collections.abc import Generator
|
||||||
import pytest
|
import pytest
|
||||||
import redis
|
import redis
|
||||||
from redis.commands.json.path import Path as RedisPath
|
from redis.commands.json.path import Path as RedisPath
|
||||||
@@ -11,7 +11,7 @@ from python_repositories.adapters.redis_adapter import RedisAdapter
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def data() -> Generator[dict[str, str], None, None]:
|
def data() -> Generator[dict[str, str]]:
|
||||||
"""Provide a sample data dictionary for tests."""
|
"""Provide a sample data dictionary for tests."""
|
||||||
yield {"foo": "bar"}
|
yield {"foo": "bar"}
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ def data() -> Generator[dict[str, str], None, None]:
|
|||||||
def data_in_redis(
|
def data_in_redis(
|
||||||
raw_redis_client: redis.Redis,
|
raw_redis_client: redis.Redis,
|
||||||
data: dict[str, str],
|
data: dict[str, str],
|
||||||
) -> Generator[tuple[str, dict[str, str]], None, None]:
|
) -> Generator[tuple[str, dict[str, str]]]:
|
||||||
"""Fixture to set up a known value in Redis before each test."""
|
"""Fixture to set up a known value in Redis before each test."""
|
||||||
key = "test_key"
|
key = "test_key"
|
||||||
path = RedisPath.root_path()
|
path = RedisPath.root_path()
|
||||||
@@ -33,7 +33,7 @@ def data_in_redis(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def redis_adapter(redis_container: str) -> Generator[RedisAdapter, None, None]:
|
def redis_adapter(redis_container: str) -> Generator[RedisAdapter]:
|
||||||
"""Fixture to provide a connected RedisAdapter instance."""
|
"""Fixture to provide a connected RedisAdapter instance."""
|
||||||
adapter = RedisAdapter()
|
adapter = RedisAdapter()
|
||||||
adapter.connect()
|
adapter.connect()
|
||||||
|
|||||||
Reference in New Issue
Block a user