py3: fix recursion issue under py37

Add tox target and resolve issue with infinite recursion in
ExtraProperties class by directly using methods on the dict
class.

Closes-Bug: 1800601

Change-Id: Ie98c4287c8bd1c364655adb99c7a88d1d451496e
This commit is contained in:
James Page 2018-11-02 10:10:49 +00:00
parent 0b13db85bb
commit 43587fb93d
2 changed files with 18 additions and 4 deletions

View File

@ -300,9 +300,9 @@ class ExtraProperties(collections.MutableMapping, dict):
def __eq__(self, other):
if isinstance(other, ExtraProperties):
return dict(self).__eq__(dict(other))
return dict.__eq__(self, dict(other))
elif isinstance(other, dict):
return dict(self).__eq__(other)
return dict.__eq__(self, other)
else:
return False
@ -310,10 +310,10 @@ class ExtraProperties(collections.MutableMapping, dict):
return not self.__eq__(other)
def __len__(self):
return dict(self).__len__()
return dict.__len__(self)
def keys(self):
return dict(self).keys()
return dict.keys(self)
class ImageMembership(object):

14
tox.ini
View File

@ -34,6 +34,10 @@ commands = ostestr --slowest {posargs}
basepython = python3.5
commands = ostestr --slowest {posargs}
[testenv:py37]
basepython = python3.7
commands = ostestr --slowest {posargs}
[testenv:functional]
setenv =
TEST_PATH = ./glance/tests/functional
@ -51,6 +55,16 @@ whitelist_externals =
commands =
stestr run --blacklist-file ./broken-functional-py35-ssl-tests.txt {posargs}
[testenv:functional-py37]
basepython = python3.7
setenv =
TEST_PATH = ./glance/tests/functional
ignore_errors = True
whitelist_externals =
bash
commands =
stestr run --blacklist-file ./broken-functional-py35-ssl-tests.txt {posargs}
[testenv:broken-py35-ssl-tests]
# NOTE(rosmaita): these tests were being skipped due to bug #1482633, but we
# want it to be obvious that Glance is affected by the eventlet ssl-handshake