From 5815d9478116cfa01509242232fd197aa5021c9f Mon Sep 17 00:00:00 2001 From: kushalagrawal Date: Tue, 30 Jul 2019 16:40:26 +0530 Subject: [PATCH] Made it compatible to python3.7 Due to https://www.python.org/dev/peps/pep-0479/ stopIteration will not be caught anymore and needs to be use return instead. updated with relevant changes. Change-Id: If25b6ccecd46fed0225a230096041996fb91c0c5 closes-bug: #1837778 --- glare/common/utils.py | 2 +- glare/tests/unit/test_utils.py | 2 +- tox.ini | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/glare/common/utils.py b/glare/common/utils.py index 5a0e44d..e04944b 100644 --- a/glare/common/utils.py +++ b/glare/common/utils.py @@ -542,7 +542,7 @@ class BlobIterator(object): bytes_left -= len(data) i += 1 yield data - raise StopIteration() + return def validate_status_transition(af, from_status, to_status): diff --git a/glare/tests/unit/test_utils.py b/glare/tests/unit/test_utils.py index 85ed1ec..a077139 100644 --- a/glare/tests/unit/test_utils.py +++ b/glare/tests/unit/test_utils.py @@ -227,7 +227,7 @@ class TestReaders(base.BaseTestCase): yield chunk iteration += 1 if iteration >= max_iterations: - raise StopIteration() + return def _test_reader_chunked(self, chunk_size, read_size, max_iterations=5): generator = self._create_generator(chunk_size, max_iterations) diff --git a/tox.ini b/tox.ini index e889c83..2b51541 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,7 @@ setenv = VIRTUAL_ENV={envdir} PYTHONDONTWRITEBYTECODE = 1 LANGUAGE=en_US usedevelop = True -install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} +install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} {opts} {packages} deps = -r{toxinidir}/test-requirements.txt commands = /bin/rm -f .testrepository/times.dbm @@ -24,8 +24,8 @@ commands = oslo_debug_helper {posargs} basepython = python2.7 commands = oslo_debug_helper {posargs} -[testenv:debug-py35] -basepython = python3.5 +[testenv:debug-py37] +basepython = python3.7 commands = oslo_debug_helper {posargs} [testenv:pep8]