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:
@@ -24,6 +24,10 @@ import os
|
|||||||
import test.functional as tf
|
import test.functional as tf
|
||||||
from test.functional.s3api.s3_test_client import (
|
from test.functional.s3api.s3_test_client import (
|
||||||
Connection, get_boto3_conn, tear_down_s3)
|
Connection, get_boto3_conn, tear_down_s3)
|
||||||
|
try:
|
||||||
|
import boto
|
||||||
|
except ImportError:
|
||||||
|
boto = None
|
||||||
|
|
||||||
|
|
||||||
def setUpModule():
|
def setUpModule():
|
||||||
@@ -52,6 +56,8 @@ class S3ApiBase(unittest.TestCase):
|
|||||||
raise SkipTest('no s3api user configured')
|
raise SkipTest('no s3api user configured')
|
||||||
if 's3api' not in tf.cluster_info:
|
if 's3api' not in tf.cluster_info:
|
||||||
raise SkipTest('s3api middleware is not enabled')
|
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'):
|
if tf.config.get('account'):
|
||||||
user_id = '%s:%s' % (tf.config['account'], tf.config['username'])
|
user_id = '%s:%s' % (tf.config['account'], tf.config['username'])
|
||||||
else:
|
else:
|
||||||
|
@@ -19,8 +19,14 @@ from six.moves.urllib.parse import urlparse
|
|||||||
import test.functional as tf
|
import test.functional as tf
|
||||||
import boto3
|
import boto3
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
from boto.s3.connection import S3Connection, OrdinaryCallingFormat, \
|
try:
|
||||||
S3ResponseError
|
from boto.s3.connection import (
|
||||||
|
S3Connection,
|
||||||
|
OrdinaryCallingFormat,
|
||||||
|
S3ResponseError,
|
||||||
|
)
|
||||||
|
except ImportError:
|
||||||
|
S3Connection = OrdinaryCallingFormat = S3ResponseError = None
|
||||||
import six
|
import six
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
Reference in New Issue
Block a user