Merge pull request #502 from cbodley/wip-58960

s3website: collections.Container removed from python3.10
This commit is contained in:
Casey Bodley 2023-03-21 17:09:04 -04:00 committed by GitHub
commit 818443e916
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,5 @@
import sys import sys
import collections from collections.abc import Container
import pytest import pytest
import string import string
import random import random
@ -159,9 +159,9 @@ def _test_website_prep(bucket, xml_template, hardcoded_fields = {}, expect_fail=
return f return f
def __website_expected_reponse_status(res, status, reason): def __website_expected_reponse_status(res, status, reason):
if not isinstance(status, collections.Container): if not isinstance(status, Container):
status = set([status]) status = set([status])
if not isinstance(reason, collections.Container): if not isinstance(reason, Container):
reason = set([reason]) reason = set([reason])
if status is not IGNORE_FIELD: if status is not IGNORE_FIELD:
@ -179,7 +179,7 @@ def _website_expected_default_html(**kwargs):
v = kwargs[k] v = kwargs[k]
if isinstance(v, str): if isinstance(v, str):
v = [v] v = [v]
elif not isinstance(v, collections.Container): elif not isinstance(v, Container):
v = [v] v = [v]
for v2 in v: for v2 in v:
s = '<li>%s: %s</li>' % (k,v2) s = '<li>%s: %s</li>' % (k,v2)
@ -199,7 +199,7 @@ def _website_expected_error_response(res, bucket_name, status, reason, code, con
if code is not IGNORE_FIELD: if code is not IGNORE_FIELD:
assert errorcode == code assert errorcode == code
if not isinstance(content, collections.Container): if not isinstance(content, Container):
content = set([content]) content = set([content])
for f in content: for f in content:
if f is not IGNORE_FIELD and f is not None: if f is not IGNORE_FIELD and f is not None: