From 43587fb93d8d949d9a9895153ac06ea4e7e6d150 Mon Sep 17 00:00:00 2001 From: James Page Date: Fri, 2 Nov 2018 10:10:49 +0000 Subject: [PATCH] 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 --- glance/domain/__init__.py | 8 ++++---- tox.ini | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/glance/domain/__init__.py b/glance/domain/__init__.py index 7feb1edfb6..0bb6a2964f 100644 --- a/glance/domain/__init__.py +++ b/glance/domain/__init__.py @@ -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): diff --git a/tox.ini b/tox.ini index 0f88bc383e..8692ec68a2 100644 --- a/tox.ini +++ b/tox.ini @@ -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