Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pytest_flask_sqlalchemy/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ def _engine(pytestconfig, request, _transaction, mocker):
elif version.parse(sa.__version__) < version.parse('1.4'):
engine._contextual_connect.return_value = connection

# Calls to execution_options should return this mocked engine.
engine.execution_options.return_value = engine

if version.parse(sa.__version__) >= version.parse('1.4'):
sa.inspection._registrars[mocker.MagicMock] = sa.engine.Inspector._engine_insp

# References to `Engine.dialect` should redirect to the Connection (this
# is primarily useful for the `autoload` flag in SQLAlchemy, which references
# the Engine dialect to reflect tables)
Expand Down