From 724a20209b68dabb8e229973d74c6ebb2fc25f09 Mon Sep 17 00:00:00 2001 From: Thomas David Date: Wed, 4 Aug 2021 13:43:41 +0100 Subject: [PATCH] fix to error I was getting with sa 1.4 --- pytest_flask_sqlalchemy/fixtures.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pytest_flask_sqlalchemy/fixtures.py b/pytest_flask_sqlalchemy/fixtures.py index 0396bd6..7b95d2a 100644 --- a/pytest_flask_sqlalchemy/fixtures.py +++ b/pytest_flask_sqlalchemy/fixtures.py @@ -103,7 +103,9 @@ def _engine(pytestconfig, request, _transaction, mocker): if version.parse(sa.__version__) < version.parse('1.3'): engine.contextual_connect.return_value = connection elif version.parse(sa.__version__) < version.parse('1.4'): - engine._contextual_connect.return_value = connection + class Cc: + return_value = connection + engine._contextual_connect = Cc # References to `Engine.dialect` should redirect to the Connection (this # is primarily useful for the `autoload` flag in SQLAlchemy, which references