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
This commit is contained in:
Tim Burke 2024-05-03 13:24:02 -07:00
parent ec3224cc18
commit dd8b7656da
2 changed files with 14 additions and 2 deletions

View File

@ -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:

View File

@ -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