From 2d1f6919fc29ea85a97074e41fea02b197642448 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Wed, 13 Nov 2024 11:27:54 +0000 Subject: [PATCH] Fix tests when sqs_extended_client is not installed The try/except block was triggering when sqs_extended_client isn't installed, which results in boto being overwritten with None --- kombu/asynchronous/aws/ext.py | 7 +++++-- kombu/asynchronous/aws/sqs/ext.py | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/kombu/asynchronous/aws/ext.py b/kombu/asynchronous/aws/ext.py index 648da8ad..541b3f30 100644 --- a/kombu/asynchronous/aws/ext.py +++ b/kombu/asynchronous/aws/ext.py @@ -4,14 +4,12 @@ from __future__ import annotations try: import boto3 - import sqs_extended_client from botocore import exceptions from botocore.awsrequest import AWSRequest from botocore.httpsession import get_cert_path from botocore.response import get_response except ImportError: boto3 = None - sqs_extended_client = None class _void: pass @@ -24,6 +22,11 @@ except ImportError: get_response = _void() get_cert_path = _void() +try: + import sqs_extended_client +except ImportError: + sqs_extended_client = None + __all__ = ( 'exceptions', 'AWSRequest', 'get_response', 'get_cert_path', diff --git a/kombu/asynchronous/aws/sqs/ext.py b/kombu/asynchronous/aws/sqs/ext.py index 96d4f590..8ca782ab 100644 --- a/kombu/asynchronous/aws/sqs/ext.py +++ b/kombu/asynchronous/aws/sqs/ext.py @@ -5,7 +5,10 @@ from __future__ import annotations try: import boto3 - import sqs_extended_client except ImportError: boto3 = None + +try: + import sqs_extended_client +except ImportError: sqs_extended_client = None