Skip to content

Commit b1b1826

Browse files
committed
working on inspection
1 parent 299472a commit b1b1826

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pytest_flask_sqlalchemy/fixtures.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ def _engine(pytestconfig, request, _transaction, mocker):
9393

9494
# Make sure that any attempts to call `connect()` simply return a
9595
# reference to the open connection
96-
engine = mocker.MagicMock(spec=sa.engine.Engine)
96+
class EngineMock(mocker.MagickMock):
97+
pass
98+
99+
engine = EngineMock(spec=sa.engine.Engine)
97100

98101
engine.connect.return_value = connection
99102

@@ -107,7 +110,7 @@ def _engine(pytestconfig, request, _transaction, mocker):
107110

108111
# Calls to execution_options should return this mocked engine
109112
engine.execution_options.return_value = engine
110-
sa.inspection._self_inspects(engine)
113+
sa.inspection._registrar[EngineMock] = sa.engine.Inspector._engine_insp
111114

112115
# References to `Engine.dialect` should redirect to the Connection (this
113116
# is primarily useful for the `autoload` flag in SQLAlchemy, which references

0 commit comments

Comments
 (0)