or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/pytest-redis@3.1.x
tile.json

tessl/pypi-pytest-redis

tessl install tessl/pypi-pytest-redis@3.1.0

Redis fixtures and fixture factories for Pytest.

Agent Success

Agent success rate when using this tile

95%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.12x

Baseline

Agent success rate without this tile

85%

task.mdevals/scenario-1/

Redis Data Persistence Test Fixture

Create a custom Redis test fixture with specific data persistence settings for testing a data-critical application that requires periodic snapshots.

Requirements

Build a custom Redis fixture that configures data persistence with the following settings:

  1. Save Configuration: Configure Redis to save snapshots with these rules:

    • Save after 60 seconds if at least 1000 keys changed
    • Save after 300 seconds if at least 100 keys changed
    • Save after 900 seconds if at least 1 key changed
  2. RDB Settings: Enable both RDB compression and checksum validation for data integrity

  3. Custom Data Directory: Use a custom temporary data directory named redis_persist_data within the system temp folder

  4. Port Configuration: Configure the Redis instance to run on port 6380

  5. Test Integration: Create a fixture that provides a Redis client connected to this configured instance

Deliverables

Create two files:

  1. conftest.py - Contains the custom fixture definitions
  2. test_persistence.py - Contains tests demonstrating the fixture works correctly

Test Cases

Your implementation should pass these test cases:

  • The Redis client fixture successfully connects to the configured Redis instance @test
  • The Redis instance runs on the specified port 6380 @test
  • Writing and reading data through the client fixture works correctly @test

Implementation

@generates

API

# Custom Redis process fixture with persistence configuration
# Returns a Redis process executor running on port 6380
def redis_persist_proc():
    pass

# Custom Redis client fixture connected to redis_persist_proc
# Returns a redis.Redis client instance
def redis_persist_client():
    pass

Dependencies { .dependencies }

pytest-redis { .dependency }

Provides Redis fixtures and fixture factories for pytest with persistence configuration support.