fix OrderedDict mutated during iteration
Running unit tests of keystoneauth in Python 3.5 reveals the issue that in Python 3.5+, keys() is not a copy, and therefore items can't be popped from it while iterating. This patch iterate over copy of session.adapters keys in Python2/3. Change-Id: I4a4340d6f0b09e047e992d0a7236f83ff5eac7a3 Closes-Bug: #1565728
This commit is contained in:
parent
54aa79d35f
commit
7dd4208e5c
@ -51,7 +51,7 @@ def _construct_session_with_betamax(fixture, session_obj=None):
|
||||
if not session_obj:
|
||||
session_obj = requests.Session()
|
||||
# Use TCPKeepAliveAdapter to fix bug 1323862
|
||||
for scheme in session_obj.adapters.keys():
|
||||
for scheme in list(session_obj.adapters.keys()):
|
||||
session_obj.mount(scheme, session.TCPKeepAliveAdapter())
|
||||
fixture.recorder = betamax.Betamax(
|
||||
session_obj, cassette_library_dir=fixture.cassette_library_dir)
|
||||
|
Loading…
Reference in New Issue
Block a user