Redis module for testcontainers-python, providing lightweight, throwaway Redis instances for integration tests. Current version is 0.0.1rc1. Part of the testcontainers-python ecosystem (v4.x). Release cadence follows the main testcontainers-python library (approximately monthly).
pip install testcontainers-redisVerified import paths — ran on the pinned version, not inferred.
Creates a Redis container, connects using redis-py, and verifies basic set/get.
Always use get_container_host_ip() and get_exposed_port() instead of hardcoding host/port.
Pin to 'testcontainers-redis==0.0.1rc1' in your requirements.
Use 'with RedisContainer() as container:' instead of manual start/stop.
Add a loop with retries on redis.exceptions.ConnectionError after starting the container.
pip install testcontainers or pip install testcontainers-redis (which pulls core).
Use 'from testcontainers.redis import RedisContainer'.
Use the container's host and port: host = redis_container.get_container_host_ip(); port = redis_container.get_exposed_port(6379).
Start Docker daemon and ensure the user has permissions (e.g., on Linux, add user to docker group).