Make CI work

Update tox.ini to be current.
Move some requirements from test-requirements directly to tox.ini.
Include a py27 constriants file for running py27 tox tests.
Remove lower-constraints.txt, it's not used anymore.
Use wallaby jobs.

Also fix some pep8 issues.

Change-Id: Ia29128ed6c12e1c51c0a34556051a3566c4f9bfd
This commit is contained in:
Riccardo Pittau
2021-01-28 16:58:36 +01:00
parent 3e595d8026
commit 1d160de11c
12 changed files with 55 additions and 99 deletions

View File

@@ -1,3 +1,3 @@
- project: - project:
templates: templates:
- openstack-lower-constraints-jobs - openstack-python3-wallaby-jobs

3
doc/requirements.txt Normal file
View File

@@ -0,0 +1,3 @@
sphinx!=1.6.6,!=1.6.7,>=1.6.2
oslosphinx>=4.7.0 # Apache-2.0

View File

@@ -1,56 +0,0 @@
alabaster==0.7.10
appdirs==1.3.0
Babel==2.3.4
coverage==4.0
debtcollector==1.2.0
docutils==0.11
extras==1.0.0
fixtures==3.0.0
flake8==2.5.5
hacking==0.12.0
imagesize==0.7.1
iso8601==0.1.11
Jinja2==2.10
keystoneauth1==3.4.0
linecache2==1.0.0
MarkupSafe==1.0
mccabe==0.2.1
mock==2.0.0
monotonic==0.6
mox3==0.20.0
msgpack-python==0.4.0
netaddr==0.7.18
netifaces==0.10.4
os-client-config==1.28.0
oslo.i18n==3.15.3
oslo.serialization==2.18.0
oslo.utils==3.33.0
oslosphinx==4.7.0
oslotest==3.2.0
pbr==2.0.0
pep8==1.5.7
pyasn1==0.1.8
pycrypto==2.6
pyflakes==0.8.1
pyghmi==1.0.22
Pygments==2.2.0
pyparsing==2.1.0
pysnmp==4.2.3
python-mimeparse==1.6.0
python-subunit==1.0.0
pytz==2013.6
PyYAML==3.12
requests-mock==1.2.0
requests==2.14.2
requestsexceptions==1.2.0
six==1.10.0
snowballstemmer==1.2.1
Sphinx==1.6.2
sphinxcontrib-websupport==1.0.1
stevedore==1.20.0
stestr==2.0.0
testscenarios==0.4
testtools==2.2.0
traceback2==1.4.0
unittest2==1.1.0
wrapt==1.7.0

1
py27-constraints.txt Normal file
View File

@@ -0,0 +1 @@
stestr==2.6.0 # Apache-2.0

View File

@@ -17,11 +17,11 @@ eLCM functionality.
""" """
import collections import collections
import six
import time import time
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import requests import requests
import six
from scciclient.irmc import scci from scciclient.irmc import scci
@@ -1092,8 +1092,8 @@ def set_bios_configuration(irmc_info, settings):
if server_version: if server_version:
bios_config_data['Server']['@Version'] = server_version bios_config_data['Server']['@Version'] = server_version
if bios_version: if bios_version:
bios_config_data['Server']['SystemConfig']['BiosConfig']['@Version'] = \ (bios_config_data['Server']['SystemConfig']['BiosConfig']
bios_version ['@Version']) = bios_version
configs = {} configs = {}
for setting_param in settings: for setting_param in settings:

View File

@@ -12,10 +12,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import six
from pysnmp.entity.rfc3413.oneliner import cmdgen from pysnmp.entity.rfc3413.oneliner import cmdgen
from pysnmp import error as snmp_error from pysnmp import error as snmp_error
import six
BMC_NAME_OID = '1.3.6.1.4.1.231.2.10.2.2.10.3.4.1.3.1.1' BMC_NAME_OID = '1.3.6.1.4.1.231.2.10.2.2.10.3.4.1.3.1.1'
IRMC_FW_VERSION_OID = '1.3.6.1.4.1.231.2.10.2.2.10.3.4.1.4.1.1' IRMC_FW_VERSION_OID = '1.3.6.1.4.1.231.2.10.2.2.10.3.4.1.4.1.1'
@@ -189,8 +189,7 @@ class SNMPClient(object):
" %(index)s" % " %(index)s" %
{'operation': "GET", 'error': error_status.prettyPrint(), {'operation': "GET", 'error': error_status.prettyPrint(),
'index': 'index':
error_index and var_binds[int(error_index) - 1] error_index and var_binds[int(error_index) - 1] or '?'})
or '?'})
# We only expect a single value back # We only expect a single value back
name, val = var_binds[0] name, val = var_binds[0]
@@ -224,8 +223,7 @@ class SNMPClient(object):
" %(index)s" % " %(index)s" %
{'operation': "GET_NEXT", 'error': error_status.prettyPrint(), {'operation': "GET_NEXT", 'error': error_status.prettyPrint(),
'index': 'index':
error_index and var_binds[int(error_index) - 1] error_index and var_binds[int(error_index) - 1] or '?'})
or '?'})
return [val for row in var_binds for name, val in row] return [val for row in var_binds for name, val in row]
@@ -256,5 +254,4 @@ class SNMPClient(object):
" %(index)s" % " %(index)s" %
{'operation': "SET", 'error': error_status.prettyPrint(), {'operation': "SET", 'error': error_status.prettyPrint(),
'index': 'index':
error_index and var_binds[int(error_index) - 1] error_index and var_binds[int(error_index) - 1] or '?'})
or '?'})

View File

@@ -14,10 +14,11 @@
import abc import abc
import re import re
import six
import socket import socket
import struct import struct
import six
from scciclient.irmc import scci from scciclient.irmc import scci
from scciclient.irmc.viom import elcm from scciclient.irmc.viom import elcm

View File

@@ -16,10 +16,9 @@ Test class for IPMI Module.
""" """
import mock import mock
import testtools
from pyghmi import exceptions as ipmi_exception from pyghmi import exceptions as ipmi_exception
from pyghmi.ipmi import command as ipmi_command from pyghmi.ipmi import command as ipmi_command
import testtools
from scciclient.irmc import ipmi from scciclient.irmc import ipmi

View File

@@ -510,7 +510,7 @@ class SCCITestCase(testtools.TestCase):
def test_get_sensor_data_records_ng(self): def test_get_sensor_data_records_ng(self):
sensor = scci.get_sensor_data_records(self.report_ng_xml) sensor = scci.get_sensor_data_records(self.report_ng_xml)
self.assertEqual(sensor, None) self.assertIsNone(sensor)
def test_get_irmc_version_ok(self): def test_get_irmc_version_ok(self):
version = scci.get_irmc_version(self.report_ok_xml) version = scci.get_irmc_version(self.report_ok_xml)
@@ -518,7 +518,7 @@ class SCCITestCase(testtools.TestCase):
def test_get_irmc_version_ng(self): def test_get_irmc_version_ng(self):
version = scci.get_irmc_version(self.report_ng_xml) version = scci.get_irmc_version(self.report_ng_xml)
self.assertEqual(version, None) self.assertIsNone(version)
def test_get_report_ok(self): def test_get_report_ok(self):
self.requests_mock.get( self.requests_mock.get(

View File

@@ -507,7 +507,7 @@ class VIOMTableTestCase(testtools.TestCase):
processing='execute', processing='execute',
mode='new') mode='new')
root.set_manage_table(VIOMTableTestCase._sample_manage_table()) root.set_manage_table(VIOMTableTestCase._sample_manage_table())
self.assertEqual(None, root.get_slot(0, create=False)) self.assertIsNone(root.get_slot(0, create=False))
slot = root.get_slot(0) slot = root.get_slot(0)
VIOMTableTestCase._add_sample_cards_to_slot(slot) VIOMTableTestCase._add_sample_cards_to_slot(slot)
self.assertEqual(slot, root.get_slot(0)) self.assertEqual(slot, root.get_slot(0))
@@ -1230,7 +1230,7 @@ class VIOMTableTestCase(testtools.TestCase):
ip='192.168.1.11', ip='192.168.1.11',
subnet='255.255.255.0', subnet='255.255.255.0',
gateway='192.168.1.1' gateway='192.168.1.1'
) )
expected_json = { expected_json = {
'DHCPUsage': False, 'DHCPUsage': False,
'Name': 'iqn-2017-04.com.fujitsu:001', 'Name': 'iqn-2017-04.com.fujitsu:001',
@@ -1248,7 +1248,7 @@ class VIOMTableTestCase(testtools.TestCase):
subnet='255.255.255.0', subnet='255.255.255.0',
gateway='192.168.1.1', gateway='192.168.1.1',
vlan_id=123 vlan_id=123
) )
expected_json = { expected_json = {
'DHCPUsage': False, 'DHCPUsage': False,
'Name': 'iqn-2017-04.com.fujitsu:001', 'Name': 'iqn-2017-04.com.fujitsu:001',
@@ -1265,7 +1265,7 @@ class VIOMTableTestCase(testtools.TestCase):
iqn='iqn-2017-04.com.fujitsu:001', iqn='iqn-2017-04.com.fujitsu:001',
ip='192.168.1.11', ip='192.168.1.11',
subnet='255.255.255.0', subnet='255.255.255.0',
) )
expected_json = { expected_json = {
'DHCPUsage': True, 'DHCPUsage': True,
'Name': 'iqn-2017-04.com.fujitsu:001', 'Name': 'iqn-2017-04.com.fujitsu:001',

View File

@@ -2,18 +2,13 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD mock>=2.0.0 # BSD
python-subunit>=1.0.0 # Apache-2.0/BSD python-subunit>=1.0.0 # Apache-2.0/BSD
oslotest>=3.2.0 # Apache-2.0 oslotest>=3.2.0,<4;python_version<'3.6' # Apache-2.0
stestr>=2.0.0 # Apache-2.0 oslotest>=3.2.0;python_version>='3.6' # Apache-2.0
stestr>=2.0.0,!=2.3.0,!=3.0.0 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT testtools>=2.2.0 # MIT
requests-mock>=1.2.0 # Apache-2.0 requests-mock>=1.2.0 # Apache-2.0
# Doc requirements
sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
oslosphinx>=4.7.0 # Apache-2.0

44
tox.ini
View File

@@ -1,25 +1,38 @@
[tox] [tox]
minversion = 2.0 minversion = 3.9.0
envlist = py35,py34,py27,pep8 envlist = py3,py27,pep8
skipsdist = True skipsdist = True
ignore_basepython_conflict=true
[testenv] [testenv]
usedevelop = True usedevelop = True
install_command = pip install {opts} {packages} install_command = pip install {opts} {packages}
deps = deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs} commands = stestr run --slowest {posargs}
[testenv:pep8] [testenv:pep8]
basepython = python3 basepython = python3
commands = flake8 deps =
hacking>=3.1.0,<4.0.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0
flake8-import-order>=0.17.1 # LGPLv3
pycodestyle>=2.0.0,<2.7.0 # MIT
Pygments>=2.2.0 # BSD
commands =
flake8 {posargs}
[testenv:venv] [testenv:venv]
basepython = python3 basepython = python3
commands = {posargs} commands = {posargs}
[testenv:py27]
deps =
-c{toxinidir}/py27-constraints.txt
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:cover] [testenv:cover]
basepython = python3 basepython = python3
setenv = setenv =
@@ -33,19 +46,22 @@ commands =
[testenv:docs] [testenv:docs]
basepython = python3 basepython = python3
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands = python setup.py build_sphinx commands = python setup.py build_sphinx
[flake8] [flake8]
# E123, E125 skipped as they are invalid PEP-8. ignore = W503,W504,W605
show-source = True show-source = True
ignore = E123,E125
builtins = _ builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
# [H106] Don't put vim configuration in source files.
[testenv:lower-constraints] # [H203] Use assertIs(Not)None to check for None.
basepython = python3 # [H204] Use assert(Not)Equal to check for equality.
deps = # [H205] Use assert(Greater|Less)(Equal) for comparison.
-c{toxinidir}/lower-constraints.txt # [H904] Delay string interpolations at logging calls.
-r{toxinidir}/test-requirements.txt enable-extensions=H106,H203,H204,H205,H904
-r{toxinidir}/requirements.txt filename = *.py
import-order-style = pep8
application-import-names = scciclient