Fix test failures and workload/websocket behavior
This commit is contained in:
@@ -24,6 +24,11 @@ engine = create_engine(
|
||||
)
|
||||
TestingSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
|
||||
# Ensure app code paths that use SessionLocal directly hit the test DB
|
||||
from app.core import database as database_module
|
||||
database_module.engine = engine
|
||||
database_module.SessionLocal = TestingSessionLocal
|
||||
|
||||
|
||||
class MockRedis:
|
||||
"""Mock Redis client for testing."""
|
||||
@@ -102,7 +107,11 @@ def db():
|
||||
@pytest.fixture(scope="function")
|
||||
def mock_redis():
|
||||
"""Create mock Redis for testing."""
|
||||
return MockRedis()
|
||||
from app.core import redis as redis_module
|
||||
client = redis_module.redis_client
|
||||
if hasattr(client, "store"):
|
||||
client.store.clear()
|
||||
return client
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
|
||||
Reference in New Issue
Block a user