Merge "tests: Tolerate NoSuchBucket errors when cleaning up"

This commit is contained in:
Zuul 2022-11-07 22:13:18 +00:00 committed by Gerrit Code Review
commit 2c4222dc6e
1 changed files with 4 additions and 0 deletions

View File

@ -190,6 +190,8 @@ class BaseS3TestCase(unittest.TestCase):
try:
client.delete_bucket(Bucket=bucket_name)
except ClientError as e:
if 'NoSuchBucket' in str(e):
return
if 'BucketNotEmpty' not in str(e):
raise
# Something's gone sideways. Try harder
@ -208,6 +210,8 @@ class BaseS3TestCase(unittest.TestCase):
try:
client.delete_bucket(Bucket=bucket_name)
except ClientError as e:
if 'NoSuchBucket' in str(e):
return
if 'BucketNotEmpty' not in str(e):
raise
if time.time() > timeout: