tessl install tessl/pypi-pytest-redis@3.1.0Redis 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%
Build a simple session storage service that uses Redis to store and retrieve user session data.
Implement a SessionStore class that manages user sessions in Redis. The class should:
Write tests using pytest fixtures to verify the SessionStore class behavior:
@generates
import json
from typing import Optional, Dict, Any
class SessionStore:
"""Manages user sessions in Redis."""
def __init__(self, redis_client):
"""Initialize with a Redis client.
Args:
redis_client: A Redis client instance
"""
pass
def create_session(self, user_id: str, session_data: Dict[str, Any]) -> None:
"""Store a new session.
Args:
user_id: The user's unique identifier
session_data: Dictionary containing session information
"""
pass
def get_session(self, user_id: str) -> Optional[Dict[str, Any]]:
"""Retrieve session data.
Args:
user_id: The user's unique identifier
Returns:
Session data dictionary if found, None otherwise
"""
pass
def delete_session(self, user_id: str) -> None:
"""Remove a session.
Args:
user_id: The user's unique identifier
"""
pass
def session_exists(self, user_id: str) -> bool:
"""Check if a session exists.
Args:
user_id: The user's unique identifier
Returns:
True if session exists, False otherwise
"""
passProvides Redis fixtures for testing.
@satisfied-by