Fix pep8 and py27, functional jobs

pyflake8 was updated and not properly constrainted by hacking, update
to hacking 3.1.0 and fix the problems found.

py27 failed since global upper-constraints includes py3 only packages.
Use lower-constraints for this test.

The functional jobs run on master with py27, remove the py27 master job,
change the jobs so that py3 is used everywhere.

Change-Id: I695d60e53857e03f206dcd7cf10c06c76c8d6cc0
This commit is contained in:
Andreas Jaeger 2020-05-31 21:21:12 +02:00 committed by Monty Taylor
parent 0d5c2b5249
commit 08c07018dc
8 changed files with 21 additions and 19 deletions

View File

@ -95,19 +95,17 @@
description: |
Run shade functional tests against a master devstack
vars:
python_version: 2.7
devstack_localrc:
Q_SERVICE_PLUGIN_CLASSES: qos
Q_ML2_PLUGIN_EXT_DRIVERS: qos,port_security
tox_environment:
SHADE_TOX_PYTHON: python3
- job:
name: shade-functional-devstack-python3
parent: shade-functional-devstack
description: |
Run shade functional tests using python3 against a master devstack
vars:
shade_environment:
SHADE_TOX_PYTHON: python3
- job:
name: shade-functional-devstack-tips-python3
@ -207,11 +205,9 @@
- shade-ansible-stable-2.5-functional-devstack:
voting: false
- shade-ansible-functional-devstack
- shade-functional-devstack
- shade-functional-devstack-magnum
- shade-functional-devstack-python3
gate:
jobs:
- shade-ansible-functional-devstack
- shade-functional-devstack
- shade-functional-devstack-python3

View File

@ -5102,7 +5102,7 @@ class OpenStackCloud(
if not img_props:
return False
self._image_client.put(
'/images/{id}'.format(image.id), headers=img_props)
'/images/{id}'.format(id=image.id), headers=img_props)
self.list_images.invalidate(self)
return True
@ -11466,7 +11466,7 @@ class OpenStackCloud(
proj = self.get_project(name_or_id)
if not proj:
raise exc.OpenStackCloudException(
"project does not exist: {}".format(name=proj.id))
"project does not exist: {name}".format(name=proj.id))
data = self._compute_client.get(
'/os-simple-tenant-usage/{project}'.format(project=proj.id),

View File

@ -305,7 +305,7 @@ class TestImage(BaseTestImage):
'X-Timestamp': '1481912480.41664',
'X-Trans-Id': 'tx60ec128d9dbf44b9add68-0058543271dfw1', # noqa
'X-Container-Bytes-Used': '0',
'Content-Type': 'text/plain; charset=utf-8'}),
'Content-Type': 'text/plain; charset=utf-8'}),
dict(method='HEAD',
uri='{endpoint}/{container}/{object}'.format(
endpoint=endpoint, container=self.container_name,

View File

@ -1,4 +1,4 @@
# Licensed under the Apache License, Version 2.0 (the 'License');
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#

View File

@ -643,7 +643,6 @@ class TestObjectUploads(BaseTestObject):
'header mismatch in manifest call')
base_object = '/{container}/{object}'.format(
endpoint=self.endpoint,
container=self.container,
object=self.object)
@ -864,7 +863,6 @@ class TestObjectUploads(BaseTestObject):
'header mismatch in manifest call')
base_object = '/{container}/{object}'.format(
endpoint=self.endpoint,
container=self.container,
object=self.object)

View File

@ -582,8 +582,7 @@ class TestSecurityGroups(base.RequestsMockTestCase):
dict(
method='GET',
uri='{endpoint}/os-security-groups'.format(
endpoint=fakes.COMPUTE_ENDPOINT,
id='server_id'),
endpoint=fakes.COMPUTE_ENDPOINT),
json={'security_groups': [nova_grp_dict]}),
dict(
method='POST',

View File

@ -225,7 +225,7 @@ class TestStack(base.RequestsMockTestCase):
dict(method='GET',
uri='{endpoint}/stacks/{id}?{resolve}'.format(
endpoint=fakes.ORCHESTRATION_ENDPOINT,
id=self.stack_id, name=self.stack_name, resolve=resolve),
id=self.stack_id, resolve=resolve),
status_code=404),
])
@ -281,7 +281,7 @@ class TestStack(base.RequestsMockTestCase):
dict(method='GET',
uri='{endpoint}/stacks/{id}?resolve_outputs=False'.format(
endpoint=fakes.ORCHESTRATION_ENDPOINT,
id=self.stack_id, name=self.stack_name),
id=self.stack_id),
status_code=302,
headers=dict(
location='{endpoint}/stacks/{name}/{id}?{resolve}'.format(

15
tox.ini
View File

@ -19,8 +19,16 @@ deps =
commands = stestr run {posargs}
stestr slowest
[testenv:py27]
deps =
# Upper-constraints does not work with py27 anymore, let's
# use lower-constraints for this test.
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:functional]
basepython = {env:SHADE_TOX_PYTHON:python2}
basepython = {env:SHADE_TOX_PYTHON:python3}
passenv = OS_* SHADE_* UPPER_CONSTRAINTS_FILE
commands = stestr --test-path ./shade/tests/functional run --serial {posargs}
stestr slowest
@ -32,7 +40,7 @@ skip_install = True
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
doc8
hacking>=2.0,<3
hacking>=3.1.0,<3.2.0
pygments
commands =
doc8 doc/source
@ -97,7 +105,8 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen
# H4 Are about docstrings - and there's just too many of them to fix
# W503 Is supposed to be off by default but a bug has it on by default. It's
# also a categorially terrible idea and Donald Knuth agrees with me.
ignore = H103,H306,H4,W503,W504
# E741 ambiguous variable name 'l'
ignore = H103,H306,H4,W503,W504,E741
show-source = True
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build