From dd8b7656daad1c244c94aa6d2bc8b4eb59c8cb3b Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Fri, 3 May 2024 13:24:02 -0700 Subject: [PATCH] Skip boto 2.x tests if boto is not installed The boto library was last updated two years ago and has rusted to the point that it's unusable on py312 -- see https://github.com/boto/boto/issues/3951 We should transition all of these tests to boto3 equivalents, but this should help out in the meantime. Related-Bug: #1557260 Related-Bug: #2063367 Change-Id: If95f45371f352c6a2d16be1a3e1b64e265bccfb4 --- test/functional/s3api/__init__.py | 6 ++++++ test/functional/s3api/s3_test_client.py | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/test/functional/s3api/__init__.py b/test/functional/s3api/__init__.py index dbb32276fe..b770d8635b 100644 --- a/test/functional/s3api/__init__.py +++ b/test/functional/s3api/__init__.py @@ -24,6 +24,10 @@ import os import test.functional as tf from test.functional.s3api.s3_test_client import ( Connection, get_boto3_conn, tear_down_s3) +try: + import boto +except ImportError: + boto = None def setUpModule(): @@ -52,6 +56,8 @@ class S3ApiBase(unittest.TestCase): raise SkipTest('no s3api user configured') if 's3api' not in tf.cluster_info: raise SkipTest('s3api middleware is not enabled') + if boto is None: + raise SkipTest('boto 2.x library is not installed') if tf.config.get('account'): user_id = '%s:%s' % (tf.config['account'], tf.config['username']) else: diff --git a/test/functional/s3api/s3_test_client.py b/test/functional/s3api/s3_test_client.py index a963317dbb..9be79304bb 100644 --- a/test/functional/s3api/s3_test_client.py +++ b/test/functional/s3api/s3_test_client.py @@ -19,8 +19,14 @@ from six.moves.urllib.parse import urlparse import test.functional as tf import boto3 from botocore.exceptions import ClientError -from boto.s3.connection import S3Connection, OrdinaryCallingFormat, \ - S3ResponseError +try: + from boto.s3.connection import ( + S3Connection, + OrdinaryCallingFormat, + S3ResponseError, + ) +except ImportError: + S3Connection = OrdinaryCallingFormat = S3ResponseError = None import six import sys import traceback