32 lines
852 B
Python
32 lines
852 B
Python
# import subprocess
|
|
# from time import sleep
|
|
# import pytest
|
|
# from redis import Redis
|
|
|
|
|
|
# @pytest.fixture(scope="session", autouse=True)
|
|
# def docker_compose():
|
|
# """Sobe os containers antes dos testes e derruba depois."""
|
|
# print("\n🚀 Subindo Docker Compose...")
|
|
# subprocess.run(["docker", "compose", "up", "-d"], check=True)
|
|
|
|
# print("⏳ Aguardando containers ficarem prontos...")
|
|
# sleep(15) # ajuste conforme necessário
|
|
|
|
# yield # os testes rodam aqui
|
|
|
|
# print("\n🧹 Derrubando Docker Compose...")
|
|
# subprocess.run(["docker", "compose", "down"], check=True)
|
|
|
|
|
|
# @pytest.fixture()
|
|
# def redis_client():
|
|
# redis = Redis(host="localhost", port=6379, decode_responses=True)
|
|
# redis.flushdb()
|
|
|
|
# yield redis
|
|
|
|
# # Limpa o banco de dados após os testes
|
|
# redis.flushdb()
|
|
# redis.close()
|