Skip to content

Commit 42a793e

Browse files
committed
conditionally registrar inspector
1 parent 1ac22cd commit 42a793e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pytest_flask_sqlalchemy/fixtures.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ class EngineMock(mocker.MagicMock):
110110

111111
# Calls to execution_options should return this mocked engine
112112
engine.execution_options.return_value = engine
113-
sa.inspection._registrars[EngineMock] = sa.engine.Inspector._engine_insp
113+
114+
if version.parse(sa.__version__) >= version.parse('1.4'):
115+
sa.inspection._registrars[EngineMock] = sa.engine.Inspector._engine_insp
114116

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

0 commit comments

Comments
 (0)