import pytest from app.crud import CRUD @pytest.fixture def mock_crud(monkeypatch): def mock_create_engine(*args, **kwargs): return 'mock_engine' monkeypatch.setattr('sqlalchemy.create_engine', mock_create_engine) return CRUD('postgresql://user:password@localhost/dbname')