CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-pytest-redis

Redis fixtures and fixture factories for Pytest.

Overall
score

95%

Overview
Eval results
Files

task.mdevals/scenario-2/

Multi-Environment Redis Testing Configuration

Build a pytest test configuration system that manages multiple isolated Redis instances with different configurations for testing a cache manager module.

Background

You are testing a cache manager that needs to work with different Redis configurations for different environments. Each environment should run on its own Redis instance to ensure complete test isolation.

Requirements

Create custom fixture configurations for two independent Redis test environments:

Development Environment

  • Should run on port 6380
  • Should use database number 0
  • Must enable automatic data cleanup between tests

Production Environment

  • Should run on a port in the range 7000-7100
  • Should use database number 1
  • Must enable automatic data cleanup between tests

Test Implementation

Write tests in test/cache_manager.test.py that verify:

  • The development Redis instance can store and retrieve a key-value pair: setting key "dev_key" to value "dev_value" and retrieving it returns "dev_value" @test
  • The production Redis instance can store and retrieve a key-value pair: setting key "prod_key" to value "prod_value" and retrieving it returns "prod_value" @test
  • Both Redis instances can be used simultaneously in the same test without interference: setting "shared_key" to "dev_data" in development and "prod_data" in production, then retrieving from each returns the correct respective values @test

Test Configuration

Configure fixtures in conftest.py to be available to all tests.

Dependencies { .dependencies }

pytest-redis { .dependency }

Provides Redis fixtures and fixture factories for Pytest.

@generates

Install with Tessl CLI

npx tessl i tessl/pypi-pytest-redis

tile.json