make python 3 the default for tox.ini
This patch is part of the community goals to enable python 3 first, and only use python 2 when explict. To do so, this patch: - Makes python 3 the default env for non py27 tox targets. - Adds a py3-dev target for running py3 locally. - Refactors the pip install commands for stable dependency install into their own target and refs them where needed. - Updates the code to pass pep8 in python 3. - Bumps the version of pylint to 1.7.1 to address some py3 issues in earlier versions. As part of this effort we should also look into making python 3 the default for our VMware NSX 3rd party CI jobs. Change-Id: Ibaa3e9d717f32ffb6479346163c14d4be7df50cf
This commit is contained in:
parent
d6daec4455
commit
2633ec0607
@ -103,7 +103,7 @@ pycparser==2.18
|
||||
pyflakes==0.8.1
|
||||
Pygments==2.2.0
|
||||
pyinotify==0.9.6
|
||||
pylint==1.4.5
|
||||
pylint==1.7.1
|
||||
pyparsing==2.1.0
|
||||
pyperclip==1.5.27
|
||||
python-dateutil==2.5.3
|
||||
|
@ -21,6 +21,6 @@ testscenarios>=0.4 # Apache-2.0/BSD
|
||||
WebTest>=2.0.27 # MIT
|
||||
bandit>=1.1.0 # Apache-2.0
|
||||
tempest>=17.1.0 # Apache-2.0
|
||||
pylint==1.4.5 # GPLv2
|
||||
pylint==1.7.1 # GPLv2
|
||||
python-openstackclient>=3.12.0 # Apache-2.0
|
||||
requests-mock>=1.2.0 # Apache-2.0
|
||||
|
70
tox.ini
70
tox.ini
@ -23,8 +23,23 @@ commands =
|
||||
setenv = OS_TEST_TIMEOUT=180
|
||||
commands = false
|
||||
|
||||
[testenv:dev]
|
||||
# run locally (not in the gate) using editable mode
|
||||
# https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs
|
||||
# note that order is important to ensure dependencies don't override
|
||||
commands =
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron#egg=neutron"
|
||||
|
||||
|
||||
[testenv:functional]
|
||||
basepython = python2.7
|
||||
basepython = python3
|
||||
setenv = {[testenv]setenv}
|
||||
{[testenv:common]setenv}
|
||||
OS_TEST_PATH=./vmware_nsx/tests/functional
|
||||
@ -34,7 +49,7 @@ deps =
|
||||
-r{toxinidir}/vmware_nsx/tests/functional/requirements.txt
|
||||
|
||||
[testenv:dsvm-functional]
|
||||
basepython = python2.7
|
||||
basepython = python3
|
||||
setenv = OS_SUDO_TESTING=1
|
||||
OS_FAIL_ON_MISSING_DEPS=1
|
||||
OS_TEST_TIMEOUT=180
|
||||
@ -49,6 +64,7 @@ commands =
|
||||
sitepackages = True
|
||||
|
||||
[testenv:releasenotes]
|
||||
basepython = python3
|
||||
deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
|
||||
-r{toxinidir}/doc/requirements.txt
|
||||
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||
@ -57,24 +73,24 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen
|
||||
setenv = OS_FAIL_ON_MISSING_DEPS=1
|
||||
|
||||
[testenv:py27-dev]
|
||||
# run py27 locally (not in the gate) using editable mode
|
||||
# https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs
|
||||
# note that order is important to ensure dependencies don't override
|
||||
commands =
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron#egg=neutron"
|
||||
{[testenv:dev]commands}
|
||||
pip freeze
|
||||
stestr run {posargs}
|
||||
whitelist_externals =
|
||||
stestr
|
||||
|
||||
[testenv:py3-dev]
|
||||
basepython = python3
|
||||
commands =
|
||||
{[testenv:dev]commands}
|
||||
pip freeze
|
||||
stestr run {posargs}
|
||||
whitelist_externals =
|
||||
stestr
|
||||
|
||||
[testenv:pep8]
|
||||
basepython = python3
|
||||
commands =
|
||||
# If it is easier to add a check via a shell script, consider adding it in this file
|
||||
sh ./tools/misc-sanity-checks.sh
|
||||
@ -88,18 +104,9 @@ whitelist_externals =
|
||||
bash
|
||||
|
||||
[testenv:pep8-dev]
|
||||
# run pep8 locally (not in the gate) using editable mode
|
||||
# https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs
|
||||
# note that order is important to ensure dependencies don't override
|
||||
basepython = python3
|
||||
commands =
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron#egg=neutron"
|
||||
{[testenv:dev]commands}
|
||||
pip freeze
|
||||
# If it is easier to add a check via a shell script, consider adding it in this file
|
||||
sh ./tools/misc-sanity-checks.sh
|
||||
@ -115,15 +122,13 @@ whitelist_externals =
|
||||
commands = bandit -r vmware_nsx -n 5 -ll
|
||||
|
||||
[testenv:cover]
|
||||
basepython = python2.7
|
||||
basepython = python3
|
||||
commands =
|
||||
python setup.py testr --coverage --testr-args='{posargs}'
|
||||
coverage report
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python3
|
||||
deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
|
||||
-r{toxinidir}/doc/requirements.txt
|
||||
commands = sphinx-build -b html doc/source doc/build/html
|
||||
@ -170,14 +175,7 @@ deps =
|
||||
[testenv:lower-constraints-dev]
|
||||
basepython = python3
|
||||
commands =
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib"
|
||||
pip install -q -e "git+https://git.openstack.org/openstack/neutron#egg=neutron"
|
||||
{[testenv:dev]commands}
|
||||
pip freeze
|
||||
stestr run {posargs}
|
||||
deps =
|
||||
|
@ -161,7 +161,9 @@ def _log_before_retry(func, trial_number):
|
||||
|
||||
def _get_args_from_frame(frames, frame_num):
|
||||
if len(frames) > frame_num and frames[frame_num] and frames[frame_num][0]:
|
||||
# pylint: disable=deprecated-method
|
||||
argvalues = inspect.getargvalues(frames[frame_num][0])
|
||||
# pylint: disable=deprecated-method
|
||||
formated_args = inspect.formatargvalues(*argvalues)
|
||||
# remove the first 'self' arg from the log as it adds no information
|
||||
formated_args = re.sub(r'\(self=.*?, ', "(", formated_args)
|
||||
|
@ -34,6 +34,7 @@ def versioned(func_table):
|
||||
cluster.api_client.get_version())
|
||||
func = get_function_by_version(func_table, func_name, v)
|
||||
func_kwargs = kwargs
|
||||
# pylint: disable=deprecated-method
|
||||
arg_spec = inspect.getargspec(func)
|
||||
if not arg_spec.keywords and not arg_spec.varargs:
|
||||
# drop args unknown to function from func_args
|
||||
|
@ -88,7 +88,9 @@ class VcnsApiHelper(object):
|
||||
|
||||
def __init__(self, address, user, password, format='json', ca_file=None,
|
||||
insecure=True, timeout=None):
|
||||
self.authToken = base64.encodestring(six.b("%s:%s" % (user, password)))
|
||||
# pylint: disable=deprecated-method
|
||||
encode_fn = base64.encodestring if six.PY2 else base64.encodebytes
|
||||
self.authToken = encode_fn(six.b("%s:%s" % (user, password)))
|
||||
self.user = user
|
||||
self.passwd = password
|
||||
self.address = address
|
||||
|
@ -64,7 +64,7 @@ class NsxTvdIpamDriver(subnet_alloc.SubnetAllocator,
|
||||
"support for IPAM", {'project': project,
|
||||
'plugin': plugin_type})
|
||||
raise ipam_exc.IpamValueInvalid(
|
||||
msg="IPAM driver not found")
|
||||
message="IPAM driver not found")
|
||||
return self.drivers[plugin_type]
|
||||
|
||||
def allocate_subnet(self, subnet_request):
|
||||
|
Loading…
Reference in New Issue
Block a user