From 7e4f1bbecce53c982df6c856c97607a225708a84 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Mon, 21 Oct 2024 12:22:45 +0300 Subject: [PATCH] Fix regression from #2148 (#2165) * Fix regression from #2148. Fixes #2157. * Fix linter error. --- kombu/transport/sqlalchemy/__init__.py | 8 ++++++++ t/unit/transport/test_sqlalchemy.py | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/kombu/transport/sqlalchemy/__init__.py b/kombu/transport/sqlalchemy/__init__.py index ee2b0e656..5f07d7b63 100644 --- a/kombu/transport/sqlalchemy/__init__.py +++ b/kombu/transport/sqlalchemy/__init__.py @@ -109,6 +109,14 @@ def _engine_from_config(self): transport_options = conninfo.transport_options.copy() transport_options.pop('queue_tablename', None) transport_options.pop('message_tablename', None) + transport_options.pop('callback', None) + transport_options.pop('errback', None) + transport_options.pop('max_retries', None) + transport_options.pop('interval_start', None) + transport_options.pop('interval_step', None) + transport_options.pop('interval_max', None) + transport_options.pop('retry_errors', None) + return create_engine(conninfo.hostname, **transport_options) def _open(self): diff --git a/t/unit/transport/test_sqlalchemy.py b/t/unit/transport/test_sqlalchemy.py index aa0907f7c..7dccc0b7e 100644 --- a/t/unit/transport/test_sqlalchemy.py +++ b/t/unit/transport/test_sqlalchemy.py @@ -1,10 +1,11 @@ from __future__ import annotations -from unittest.mock import patch +from unittest.mock import Mock, patch import pytest from kombu import Connection +from kombu.exceptions import OperationalError pytest.importorskip('sqlalchemy') @@ -24,7 +25,17 @@ def test_url_parser(self): Connection(url).connect() def test_simple_queueing(self): - conn = Connection('sqlalchemy+sqlite:///:memory:') + conn = Connection( + 'sqlalchemy+sqlite:///:memory:', + transport_options={ + "callback": Mock(), + "errback": Mock(), + "max_retries": 20, + "interval_start": 1, + "interval_step": 2, + "interval_max": 30, + "retry_errors": (OperationalError,) + }) conn.connect() try: channel = conn.channel()