import sys
import pytest
from redis import from_url, ConnectionPool, Redis

@pytest.fixture
def app():
    from flask import Flask
    app = Flask(__name__)
    return app

REDIS_URL="redis://localhost:6379/0"

def test_setup_redis(app):
    with app.app_context():
        pool = ConnectionPool.from_url(REDIS_URL)
        redis_connection = Redis(connection_pool=pool)
        redis_connection.ping()
        assert redis_connection is not None
        assert redis_connection.ping() is True
