py3: Finish porting func tests

We were (indirectly) importing swiftclient (and therefore requests and
urllib3) before doing our eventlet monkey-patching. This would lead
boto3 (which digs an SSLContext out of urllib3) to trip RecursionErrors
on py3 similar to

   >>> from ssl import SSLContext, PROTOCOL_SSLv23
   >>> import eventlet
   >>> eventlet.monkey_patch(socket=True)
   >>> SSLContext(PROTOCOL_SSLv23).options |= 0
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/usr/lib/python3.6/ssl.py", line 465, in options
       super(SSLContext, SSLContext).options.__set__(self, value)
     File "/usr/lib/python3.6/ssl.py", line 465, in options
       super(SSLContext, SSLContext).options.__set__(self, value)
     File "/usr/lib/python3.6/ssl.py", line 465, in options
       super(SSLContext, SSLContext).options.__set__(self, value)
     [Previous line repeated 330 more times]
   RecursionError: maximum recursion depth exceeded while calling a Python object

Change-Id: I4bb59edd87336597791416c4f2a096efe0e72fe3
This commit is contained in:
Tim Burke 2019-08-07 16:16:57 -07:00
parent 9b4b57a880
commit 74db367060
2 changed files with 9 additions and 26 deletions

View File

@ -43,8 +43,6 @@ from swift.common.storage_policy import parse_storage_policies, PolicyError
from swift.common.utils import set_swift_dir
from test import get_config, listen_zero
from test.functional.swift_test_client import Account, Connection, Container, \
ResponseError
from test.unit import debug_logger, FakeMemcache
# importing skip_if_no_xattrs so that functional tests can grab it from the
@ -75,6 +73,10 @@ eventlet.hubs.use_hub(utils.get_hub())
eventlet.patcher.monkey_patch(all=False, socket=True)
eventlet.debug.hub_exceptions(False)
# swift_test_client import from swiftclient, so move after the monkey-patching
from test.functional.swift_test_client import Account, Connection, Container, \
ResponseError
from swiftclient import get_auth, http_connection
has_insecure = False

29
tox.ini
View File

@ -46,48 +46,29 @@ commands = ./.functests {posargs}
[testenv:func-py3]
basepython = python3
commands =
nosetests {posargs: \
test/functional/s3api/test_acl.py \
test/functional/s3api/test_multi_delete.py \
test/functional/s3api/test_multi_upload.py \
test/functional/s3api/test_object.py \
test/functional/s3api/test_presigned.py \
test/functional/s3api/test_service.py \
test/functional/test_access_control.py \
test/functional/test_account.py \
test/functional/test_container.py \
test/functional/test_dlo.py \
test/functional/test_domain_remap.py \
test/functional/test_object.py \
test/functional/test_slo.py \
test/functional/test_staticweb.py \
test/functional/test_symlink.py \
test/functional/test_tempurl.py \
test/functional/test_versioned_writes.py \
test/functional/tests.py}
commands = ./.functests {posargs}
[testenv:func-ec-py3]
basepython = python3
commands = {[testenv:func-py3]commands}
commands = ./.functests {posargs}
setenv = SWIFT_TEST_IN_PROCESS=1
SWIFT_TEST_IN_PROCESS_CONF_LOADER=ec
[testenv:func-s3api-py3]
basepython = python3
commands = {[testenv:func-py3]commands}
commands = ./.functests {posargs}
setenv = SWIFT_TEST_IN_PROCESS=1
SWIFT_TEST_IN_PROCESS_CONF_LOADER=s3api
[testenv:func-encryption-py3]
basepython = python3
commands = {[testenv:func-py3]commands}
commands = ./.functests {posargs}
setenv = SWIFT_TEST_IN_PROCESS=1
SWIFT_TEST_IN_PROCESS_CONF_LOADER=encryption
[testenv:func-domain-remap-staticweb-py3]
basepython = python3
commands = {[testenv:func-py3]commands}
commands = ./.functests {posargs}
setenv = SWIFT_TEST_IN_PROCESS=1
SWIFT_TEST_IN_PROCESS_CONF_LOADER=domain_remap_staticweb