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-8/

Multi-Instance Redis Test Suite

Build a test suite for a distributed caching system that requires multiple isolated Redis instances running simultaneously on different ports. The system needs to test scenarios where multiple Redis servers are running in parallel without port conflicts.

Requirements

Your test suite should demonstrate the ability to:

  1. Run tests with multiple independent Redis instances simultaneously
  2. Configure Redis instances to use specific port allocation strategies to avoid conflicts
  3. Verify that each Redis instance is truly isolated and operates independently

Implementation

Create test fixtures that utilize different port allocation strategies for different test scenarios:

  • One test should use a randomly allocated port from any available port
  • One test should use a port selected from a specific range
  • One test should use a port selected from a specific set of ports
  • Ensure all Redis instances can run simultaneously without conflicts

@generates

Test Cases

  • When creating a Redis fixture with random port allocation, it successfully starts a Redis instance on an available port @test
  • When creating a Redis fixture with a port range (3000-3100), it successfully starts a Redis instance within that range @test
  • When creating a Redis fixture with a specific port set {6380, 6381, 6382}, it successfully starts a Redis instance using one of those ports @test
  • Multiple Redis fixtures with different port strategies can run simultaneously in the same test without conflicts @test

API

import pytest
from pytest_redis import factories

# Custom Redis fixtures with different port allocation strategies
redis_random = factories.redis_proc(port=None)
redis_range = factories.redis_proc(port=(3000, 3100))
redis_set = factories.redis_proc(port={6380, 6381, 6382})

# Corresponding client fixtures
redisdb_random = factories.redisdb('redis_random')
redisdb_range = factories.redisdb('redis_range')
redisdb_set = factories.redisdb('redis_set')

def test_random_port(redisdb_random):
    """Test Redis instance with random port allocation"""
    pass

def test_port_range(redisdb_range):
    """Test Redis instance with port range allocation"""
    pass

def test_port_set(redisdb_set):
    """Test Redis instance with port set allocation"""
    pass

def test_multiple_instances(redisdb_random, redisdb_range, redisdb_set):
    """Test multiple Redis instances running simultaneously"""
    pass

Dependencies { .dependencies }

pytest-redis { .dependency }

Provides Redis fixtures and fixture factories for testing with flexible port allocation strategies.