diff --git a/.zuul.yaml b/.zuul.yaml index 57fc3c6c..6b448838 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -6,7 +6,7 @@ - stx-release-notes-jobs check: jobs: - - openstack-tox-linters + - nfv-tox-linters - nfv-tox-pep8 - nfv-tox-py39 - nfv-tox-pylint @@ -14,7 +14,7 @@ - nova-api-proxy-tox-pylint gate: jobs: - - openstack-tox-linters + - nfv-tox-linters - nfv-tox-pep8 - nfv-tox-py39 - nfv-tox-pylint @@ -24,26 +24,34 @@ jobs: - stx-nfv-upload-git-mirror +- job: + name: nfv-tox-linters + parent: tox + nodeset: debian-bullseye + description: Run linters + vars: + tox_envlist: linters + - job: name: nfv-tox-py39 - parent: openstack-tox-py39 + parent: tox description: Run py39 for nfv nodeset: debian-bullseye required-projects: - starlingx/config - starlingx/fault - - starlingx/root - starlingx/update vars: + tox_envlist: py39 tox_extra_args: -c nfv/tox.ini - tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt' - job: name: nfv-tox-pep8 - parent: openstack-tox-pep8 + parent: tox description: Run pep8 for nfv nodeset: debian-bullseye vars: + tox_envlist: pep8 tox_extra_args: -c nfv/tox.ini - job: @@ -51,12 +59,9 @@ parent: tox description: Run bandit for nfv nodeset: debian-bullseye - required-projects: - - starlingx/root vars: tox_envlist: bandit tox_extra_args: -c nfv/tox.ini - tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt' - job: name: nfv-tox-pylint @@ -66,12 +71,10 @@ required-projects: - starlingx/config - starlingx/fault - - starlingx/root - starlingx/update vars: tox_envlist: pylint tox_extra_args: -c nfv/tox.ini - tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt' - job: name: nova-api-proxy-tox-pep8 @@ -87,12 +90,9 @@ parent: tox description: Run pylint for nova-api-proxy nodeset: debian-bullseye - required-projects: - - starlingx/root vars: tox_envlist: pylint tox_extra_args: -c nova-api-proxy/tox.ini - tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt' - job: name: stx-nfv-upload-git-mirror diff --git a/nfv/nfv-common/nfv_common/helpers.py b/nfv/nfv-common/nfv_common/helpers.py index ada85c99..3d86ec9a 100755 --- a/nfv/nfv-common/nfv_common/helpers.py +++ b/nfv/nfv-common/nfv_common/helpers.py @@ -56,8 +56,8 @@ class Result(object): self.ancillary_data = ancillary_data def __str__(self): - return("Result: result-data: %s ancillary-data: %s" - % (self.result_data, self.ancillary_data)) + return ("Result: result-data: %s ancillary-data: %s" + % (self.result_data, self.ancillary_data)) class Constants(object): diff --git a/nfv/nfv-common/nfv_common/tasks/unit_test.py b/nfv/nfv-common/nfv_common/tasks/unit_test.py index b6f9fdf5..23a887c2 100755 --- a/nfv/nfv-common/nfv_common/tasks/unit_test.py +++ b/nfv/nfv-common/nfv_common/tasks/unit_test.py @@ -47,13 +47,13 @@ def unit_test(title): def _task_non_coroutine(arg1): global _test_complete _test_complete = True - assert(arg1 == 'arg1') + assert (arg1 == 'arg1') return True def _task_work_func(arg1, arg2): - assert(arg1 == 'arg1') - assert(arg2 == 'arg2') + assert (arg1 == 'arg1') + assert (arg2 == 'arg2') return "FUNCTION PASSED" @@ -61,13 +61,13 @@ def _task_work_func(arg1, arg2): def _task_coroutine_callback(): global _test_complete, _test_result result = (yield) - assert(result == "FUNCTION PASSED") + assert (result == "FUNCTION PASSED") _test_complete = True _test_result = True def _task_coroutine(future, arg1, callback): - assert(arg1 == 'arg1') + assert (arg1 == 'arg1') future.work(_task_work_func, 'arg1', 'arg2') future.result = (yield) if future.result.is_complete(): @@ -77,7 +77,7 @@ def _task_coroutine(future, arg1, callback): def _task_coroutine_with_timer(future, arg1, callback): - assert(arg1 == 'arg1') + assert (arg1 == 'arg1') timer_id = future.timer('timer-test', 2) start_ms = timers.get_monotonic_timestamp_in_ms() future.result = (yield) diff --git a/nfv/nfv-debug-tools/histogram_analysis/plotter.py b/nfv/nfv-debug-tools/histogram_analysis/plotter.py index 223b94ae..2654bfec 100755 --- a/nfv/nfv-debug-tools/histogram_analysis/plotter.py +++ b/nfv/nfv-debug-tools/histogram_analysis/plotter.py @@ -227,7 +227,7 @@ def pCommand(pList): isFile = True procList.append(pList[i]) else: - while(not isFile): + while (not isFile): print("\nFiles containing keyword: %s" % (str(procName))) csvFile = str(procName) + ".csv" for root, directories, filenames in os.walk(pth): @@ -351,7 +351,7 @@ def setFilename(graphName): graphName = time.strftime("%m-%d-%Y") if os.path.exists(str(graphName + ".html")): n = 1 - while(not validName): + while (not validName): if os.path.exists(str(graphName + "(" + str(n) + ").html")): n += 1 else: @@ -468,7 +468,7 @@ if config: # If only one of execution time and delta hits was specified, generate one graph. if procs: if (execTime and hits): - if(not oneAxis): + if (not oneAxis): fig = tools.make_subplots(rows=2, cols=1) storeGraphData(procs, dateRange, execTime, False, 1) storeGraphData(procs, dateRange, False, hits, 2) diff --git a/nfv/nfv-tests/nfv_unit_tests/tests/test_dhcp_network_rebalance_randomized.py b/nfv/nfv-tests/nfv_unit_tests/tests/test_dhcp_network_rebalance_randomized.py index e26d271a..acf6d36b 100644 --- a/nfv/nfv-tests/nfv_unit_tests/tests/test_dhcp_network_rebalance_randomized.py +++ b/nfv/nfv-tests/nfv_unit_tests/tests/test_dhcp_network_rebalance_randomized.py @@ -285,10 +285,10 @@ class TestNeutronDHCPRebalance(testcase.NFVTestCase): if (old_state != DHCP_REBALANCE_STATE.DONE) and \ (old_state != DHCP_REBALANCE_STATE.HOLD_OFF): if _DHCPRebalance.num_dhcp_agents < 2: - assert(new_state == DHCP_REBALANCE_STATE.DONE) + assert (new_state == DHCP_REBALANCE_STATE.DONE) else: - assert(new_state == - DHCP_REBALANCE_STATE.GET_NETWORKS_HOSTED_ON_AGENT) + assert (new_state == + DHCP_REBALANCE_STATE.GET_NETWORKS_HOSTED_ON_AGENT) if ((old_state == DHCP_REBALANCE_STATE.GET_NETWORKS_HOSTED_ON_AGENT) and @@ -376,8 +376,8 @@ class TestNeutronDHCPRebalance(testcase.NFVTestCase): doing_abort = False if (old_state != DHCP_REBALANCE_STATE.DONE) and \ (old_state != DHCP_REBALANCE_STATE.HOLD_OFF): - assert(new_state == - DHCP_REBALANCE_STATE.HOLD_OFF) + assert (new_state == + DHCP_REBALANCE_STATE.HOLD_OFF) if ((old_state == DHCP_REBALANCE_STATE.GET_NETWORKS_HOSTED_ON_AGENT) and diff --git a/nfv/nfv-tests/nfv_unit_tests/tests/test_network_rebalance_randomized.py b/nfv/nfv-tests/nfv_unit_tests/tests/test_network_rebalance_randomized.py index 56c05a70..f601de72 100644 --- a/nfv/nfv-tests/nfv_unit_tests/tests/test_network_rebalance_randomized.py +++ b/nfv/nfv-tests/nfv_unit_tests/tests/test_network_rebalance_randomized.py @@ -327,10 +327,10 @@ class TestNeutronRebalance2(testcase.NFVTestCase): if (old_state != L3_REBALANCE_STATE.DONE) and \ (old_state != L3_REBALANCE_STATE.HOLD_OFF): if _L3Rebalance.num_l3agents < 2: - assert(new_state == L3_REBALANCE_STATE.DONE) + assert (new_state == L3_REBALANCE_STATE.DONE) else: - assert(new_state == - L3_REBALANCE_STATE.GET_ROUTERS_HOSTED_ON_AGENT) + assert (new_state == + L3_REBALANCE_STATE.GET_ROUTERS_HOSTED_ON_AGENT) if ((old_state == L3_REBALANCE_STATE.GET_ROUTERS_HOSTED_ON_AGENT) and @@ -476,8 +476,8 @@ class TestNeutronRebalance2(testcase.NFVTestCase): doing_abort = False if (old_state != L3_REBALANCE_STATE.DONE) and \ (old_state != L3_REBALANCE_STATE.HOLD_OFF): - assert(new_state == - L3_REBALANCE_STATE.HOLD_OFF) + assert (new_state == + L3_REBALANCE_STATE.HOLD_OFF) if ((old_state == L3_REBALANCE_STATE.GET_ROUTERS_HOSTED_ON_AGENT) and diff --git a/nfv/nfv-vim/nfv_vim/strategy/_strategy_steps.py b/nfv/nfv-vim/nfv_vim/strategy/_strategy_steps.py index 6f96fc94..c5825bad 100755 --- a/nfv/nfv-vim/nfv_vim/strategy/_strategy_steps.py +++ b/nfv/nfv-vim/nfv_vim/strategy/_strategy_steps.py @@ -1985,7 +1985,7 @@ class MigrateInstancesFromHostStep(strategy.StrategyStep): """ from nfv_vim import directors - if(self._instance_names): + if (self._instance_names): DLOG.info("Step (%s) apply for instances %s running on hosts %s." % ( self._name, self._instance_names, diff --git a/nfv/test-requirements.txt b/nfv/test-requirements.txt index ccba0db9..5737e7a7 100644 --- a/nfv/test-requirements.txt +++ b/nfv/test-requirements.txt @@ -1,7 +1,7 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking>=1.1.0,<=2.0.0 # Apache-2.0 +hacking>=1.1.0 # Apache-2.0 bandit coverage>=3.6 fixtures>=3.0.0 # Apache-2.0/BSD diff --git a/nova-api-proxy/nova-api-proxy/nova_api_proxy/apps/acceptor.py b/nova-api-proxy/nova-api-proxy/nova_api_proxy/apps/acceptor.py index b07f72a1..0f98f222 100644 --- a/nova-api-proxy/nova-api-proxy/nova_api_proxy/apps/acceptor.py +++ b/nova-api-proxy/nova-api-proxy/nova_api_proxy/apps/acceptor.py @@ -93,14 +93,14 @@ class APIController(Middleware): self._log_message(environ) def _print_data(self, obj): - if type(obj) == dict: + if isinstance(obj, dict): for k, v in obj.items(): if hasattr(v, '__iter__'): LOG.info("%s" % k) self._print_data(v) else: LOG.info('%s : %s' % (k, v)) - elif type(obj) == list: + elif isinstance(obj, list): for v in obj: if hasattr(v, '__iter__'): self._print_data(v) diff --git a/nova-api-proxy/test-requirements.txt b/nova-api-proxy/test-requirements.txt index 82e87bec..baa359a5 100644 --- a/nova-api-proxy/test-requirements.txt +++ b/nova-api-proxy/test-requirements.txt @@ -1,8 +1,8 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking>=1.1.0,<=2.0.0 # Apache-2.0 -bandit<1.6.0;python_version>="3.0" +hacking>=1.1.0 # Apache-2.0 +bandit coverage>=3.6 fixtures>=3.0.0 # Apache-2.0/BSD pylint diff --git a/test-requirements.txt b/test-requirements.txt index 0fbded31..0e4b6995 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,4 @@ -bashate < 1.0.0 +bashate PyYAML >= 3.1.0 -yamllint<1.26.1;python_version>="3.0" # GPLv2 +yamllint