Python2: Fix tox -e py27
With this change, unit tests now pass on Python 2.7: tox -e py27. Changes: * Replace "yield from ..." with "for item in ...: yield item" * Remove last annotations from utils.py * tox.ini: use python3 as basepython rather than python3.5 to support Python 2.7 and Python 3.6 * tox.ini: add py27 to envlist Related-Bug: 1726399 Change-Id: Ief1a95402e8a31a34ada2937a7ae6a604f7f8757
This commit is contained in:
parent
c1d38f741b
commit
af88d16028
@ -30,7 +30,8 @@ class Objects(base.ServiceResource, glance.ListImagesMixin, ListObjectsMixin):
|
||||
self.cloud.list_volume_backups() == [])
|
||||
|
||||
def list(self):
|
||||
yield from self.list_objects()
|
||||
for item in self.list_objects():
|
||||
yield item
|
||||
|
||||
def delete(self, resource):
|
||||
self.cloud.delete_object(resource['container_name'], resource['name'])
|
||||
|
@ -59,12 +59,12 @@ def monkeypatch_oscc_logging_warning(f):
|
||||
oscc_target = 'os_client_config.cloud_config'
|
||||
orig_logging = logging.getLogger(oscc_target).warning
|
||||
|
||||
def logging_warning(msg: str, *args, **kwargs):
|
||||
def logging_warning(msg, *args, **kwargs):
|
||||
if 'catalog entry not found' not in msg:
|
||||
orig_logging(msg, *args, **kwargs)
|
||||
|
||||
@functools.wraps(f)
|
||||
def wrapper(*args: list, **kwargs):
|
||||
def wrapper(*args, **kwargs):
|
||||
try:
|
||||
setattr(logging.getLogger(oscc_target), 'warning', logging_warning)
|
||||
return f(*args, **kwargs)
|
||||
|
8
tox.ini
8
tox.ini
@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist = pep8,pip-check-reqs,cover,py35
|
||||
envlist = pep8,pip-check-reqs,cover,py35,py27
|
||||
minversion = 1.9
|
||||
skipsdist = True
|
||||
|
||||
@ -8,13 +8,12 @@ usedevelop=True
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
basepython =
|
||||
run,pep8,cover,mypy,pip-check-reqs,py35,functional: python3.5
|
||||
docs,venv: python2
|
||||
basepython = python3
|
||||
commands =
|
||||
python setup.py testr --testr-args='{posargs}'
|
||||
|
||||
[testenv:venv]
|
||||
basepython = python2.7
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:run]
|
||||
@ -60,6 +59,7 @@ commands=
|
||||
pip-missing-reqs -d ospurge
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python2.7
|
||||
whitelist_externals = echo
|
||||
skip_install = True
|
||||
deps =
|
||||
|
Loading…
Reference in New Issue
Block a user