--- id: pytest-redis version: "4.0.0" license: GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this… (full text in the JSON record) license_treatment: copyleft maintenance: active --- # pytest-redis — Redis fixtures and fixture factories for Pytest. License: copyleft · Maintenance: active · Downloads: 265.5K/mo ## What it is and what it does pytest-redis is a pytest plugin that automates Redis setup and teardown for test suites. It provides three fixtures: redisdb (function-scoped client that cleans databases after each test), redis_proc (session-scoped process that starts Redis on first use and stops at test end), and redis_noproc (connects to an already-running Redis instance). The plugin manages port allocation, process lifecycle, and client connections, allowing developers to write tests that interact with Redis without manual server management. The plugin integrates with pytest's fixture system and supports extensive configuration through fixture factory arguments, command-line options, or pytest.ini settings. It handles Redis executable discovery, port binding, authentication, logging, and data persistence options. Developers can create multiple Redis fixtures with different configurations for testing scenarios requiring multiple Redis instances or specific server settings. Use it for: - Unit testing code that reads/writes to Redis without requiring manual server startup or teardown between tests. - Integration testing multi-instance Redis scenarios by creating separate redis_proc and redisdb fixtures with different configurations. - Testing against an external Redis instance in CI/CD by using redis_noproc fixture to connect to a pre-running container. - Validating Redis-based caching layers and session stores in web applications during test execution. - Testing Redis Pub/Sub or stream functionality by configuring multiple client fixtures against a single Redis process. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A pytest plugin that provides fixtures for testing code that depends on Redis, managing both Redis process lifecycle and client connections during test execution. Yes. The plugin is actively maintained, has low install friction, supports modern Python versions (3.10–3.14), and solves a real testing problem—automating Redis lifecycle management. The LGPLv3+ license is permissive for most use cases via the linking exception. No known vulnerabilities. Install if your test suite depends on Redis. ## Install pip install pytest-redis uv add pytest-redis poetry add pytest-redis ## Installing pytest-redis Before you install: Low friction install with active maintenance. Depends on pytest, port-for, mirakuru, and redis; all are standard testing/utility packages. Last release 167 days ago, repository active with recent commits. License in practice: Licensed under LGPLv3+, a copyleft license. Derivative works and modifications must be released under compatible terms, but linking to the library from proprietary code is permitted under LGPL's linking exception. Quickstart: pip install pytest-redis import pytest from pytest_redis import factories def test_redis(redisdb): redisdb.set('key', 'value') assert redisdb.get('key') == b'value' redis-server executable must be available on PATH or passed explicitly via --redis-exec; Redis must be installed locally or available in a container. Verify before relying: - Whether the plugin supports Redis modules and extension loading in production scenarios beyond the documented test configuration. - Performance characteristics when running many tests with redis_proc fixture across different scopes. ## Package facts - License: GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this… (full text in the JSON record) (copyleft) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 265.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest redis fixtures, redis testing plugin, test redis database, pytest redis process, redis test fixtures, redis integration testing, pytest redis client, redis-testing, pytest-plugin, fixture-factory [View on SkillFed](https://skillfed.io/packages/pytest-redis) · [View on PyPI](https://pypi.org/project/pytest-redis/)