Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion localstack-core/localstack/testing/pytest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2135,8 +2135,28 @@ def cleanups():
for cleanup_callback in cleanup_fns[::-1]:
try:
cleanup_callback()
except ClientError as e:
http_code = e.response["ResponseMetadata"]["HTTPStatusCode"]
# Covers non-standardized error codes such as NotFoundException, NoSuchEntity (IAM), NoSuchBucket (S3), etc
if http_code == 404:
LOG.warning(
"Failed to execute cleanup because a resource was not found. "
"This cleanup might be unnecessary. %s",
str(e),
exc_info=e,
)
else:
LOG.warning(
"Failed to execute cleanup due to ClientError: %s",
str(e),
exc_info=e,
)
except Exception as e:
LOG.warning("Failed to execute cleanup", exc_info=e)
LOG.warning(
"Failed to execute cleanup due to unexpected error: %s",
str(e),
exc_info=e,
)


@pytest.fixture(scope="session")
Expand Down
Loading