Enable python3 unit testing in zuul for nfv

This does not ensure nfv is python3 compatable, but
it does ensure that the current unit tests and code covered
by those tests work in python3.

The shell.py changes are due to a change in default values in argparse.

The instance director change is because python3 uses a reference
rather than a copy, for its dict keys.

Story: 2003427
Task: 28818
Change-Id: Iaccc0ab5fc4e30b41df108f817612abad8ec612c
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
This commit is contained in:
Al Bailey 2019-01-09 09:36:05 -06:00
parent 7251eec3ba
commit 5b77ef8b91
3 changed files with 18 additions and 1 deletions

View File

@ -9,6 +9,7 @@
- openstack-tox-linters - openstack-tox-linters
- nfv-tox-pep8 - nfv-tox-pep8
- nfv-tox-py27 - nfv-tox-py27
- nfv-tox-py35
- nfv-tox-pylint - nfv-tox-pylint
- nova-api-proxy-tox-pep8 - nova-api-proxy-tox-pep8
- nova-api-proxy-tox-pylint - nova-api-proxy-tox-pylint
@ -21,6 +22,7 @@
- openstack-tox-linters - openstack-tox-linters
- nfv-tox-pep8 - nfv-tox-pep8
- nfv-tox-py27 - nfv-tox-py27
- nfv-tox-py35
- nfv-tox-pylint - nfv-tox-pylint
- nova-api-proxy-tox-pep8 - nova-api-proxy-tox-pep8
- nova-api-proxy-tox-pylint - nova-api-proxy-tox-pylint
@ -40,6 +42,16 @@
tox_envlist: py27 tox_envlist: py27
tox_extra_args: -c nfv/tox.ini tox_extra_args: -c nfv/tox.ini
- job:
name: nfv-tox-py35
parent: tox
description: Run py35 for nfv
required-projects:
- openstack/stx-fault
vars:
tox_envlist: py35
tox_extra_args: -c nfv/tox.ini
- job: - job:
name: nfv-tox-pep8 name: nfv-tox-pep8
parent: tox parent: tox

View File

@ -28,6 +28,7 @@ def process_main(argv=sys.argv[1:]): # pylint: disable=dangerous-default-value
parser.add_argument('--os-interface', default=None) parser.add_argument('--os-interface', default=None)
commands = parser.add_subparsers(title='Commands', metavar='') commands = parser.add_subparsers(title='Commands', metavar='')
commands.required = True
# Software Patch Commands # Software Patch Commands
sw_patch_parser = commands.add_parser('patch-strategy', sw_patch_parser = commands.add_parser('patch-strategy',
@ -36,6 +37,7 @@ def process_main(argv=sys.argv[1:]): # pylint: disable=dangerous-default-value
sw_patch_cmds = sw_patch_parser.add_subparsers( sw_patch_cmds = sw_patch_parser.add_subparsers(
title='Software Patch Commands', metavar='') title='Software Patch Commands', metavar='')
sw_patch_cmds.required = True
sw_patch_create_strategy_cmd \ sw_patch_create_strategy_cmd \
= sw_patch_cmds.add_parser('create', help='Create a strategy') = sw_patch_cmds.add_parser('create', help='Create a strategy')
@ -99,6 +101,7 @@ def process_main(argv=sys.argv[1:]): # pylint: disable=dangerous-default-value
sw_upgrade_cmds = sw_upgrade_parser.add_subparsers( sw_upgrade_cmds = sw_upgrade_parser.add_subparsers(
title='Software Upgrade Commands', metavar='') title='Software Upgrade Commands', metavar='')
sw_upgrade_cmds.required = True
sw_upgrade_create_strategy_cmd \ sw_upgrade_create_strategy_cmd \
= sw_upgrade_cmds.add_parser('create', help='Create a strategy') = sw_upgrade_cmds.add_parser('create', help='Create a strategy')

View File

@ -229,7 +229,9 @@ class InstanceDirector(object):
instances_failed.append(instance) instances_failed.append(instance)
# Remove reboot counts for instances that recovered # Remove reboot counts for instances that recovered
reboot_tracking_instance_uuids = self._reboot_count.keys() # Make a copy of the keys for this to work in python3
# since _reboot_count is changing while iterating
reboot_tracking_instance_uuids = list(self._reboot_count.keys())
for instance_uuid in reboot_tracking_instance_uuids: for instance_uuid in reboot_tracking_instance_uuids:
if instance_uuid not in instance_tracking_uuids: if instance_uuid not in instance_tracking_uuids: