Fix pylint errors 03/58703/1
authorCédric Ollivier <cedric.ollivier@orange.com>
Tue, 19 Jun 2018 05:14:42 +0000 (07:14 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Tue, 19 Jun 2018 05:16:33 +0000 (07:16 +0200)
They are highlighted by the last pylint version.

Change-Id: I473212a413013492716993fb536903b13bff66ed
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
functest/opnfv_tests/openstack/rally/rally.py
functest/opnfv_tests/openstack/snaps/health_check.py
functest/opnfv_tests/openstack/snaps/snaps_utils.py
functest/opnfv_tests/sdn/odl/odl.py
functest/opnfv_tests/vnf/router/cloudify_vrouter.py
functest/opnfv_tests/vnf/router/utilvnf.py
functest/opnfv_tests/vnf/router/vnf_controller/vm_controller.py
functest/opnfv_tests/vnf/router/vrouter_base.py
functest/tests/unit/odl/test_odl.py
test-requirements.txt
tox.ini

index cca1988..c3c53fb 100644 (file)
@@ -286,7 +286,7 @@ class RallyBase(testcase.TestCase):
                                self.excl_scenario()))
 
         if black_tests:
-            LOGGER.debug("Blacklisted tests: " + str(black_tests))
+            LOGGER.debug("Blacklisted tests: %s", str(black_tests))
 
         include = True
         for cases_line in cases_file:
@@ -358,9 +358,9 @@ class RallyBase(testcase.TestCase):
 
         # parse JSON operation result
         if self.task_succeed(json_results):
-            LOGGER.info('Test scenario: "{}" OK.'.format(test_name) + "\n")
+            LOGGER.info('Test scenario: "%s" OK.', test_name)
         else:
-            LOGGER.info('Test scenario: "{}" Failed.'.format(test_name) + "\n")
+            LOGGER.info('Test scenario: "%s" Failed.', test_name)
 
     def _run_task(self, test_name):
         """Run a task."""
@@ -369,7 +369,7 @@ class RallyBase(testcase.TestCase):
         task_file = os.path.join(self.RALLY_DIR, 'task.yaml')
         if not os.path.exists(task_file):
             LOGGER.error("Task file '%s' does not exist.", task_file)
-            raise Exception("Task file '%s' does not exist.", task_file)
+            raise Exception("Task file '{}' does not exist.".format(task_file))
 
         file_name = self._prepare_test_list(test_name)
         if self.file_is_empty(file_name):
index 8a88ac6..3a9c821 100644 (file)
 
 import unittest
 
+from snaps.openstack.tests.create_instance_tests import SimpleHealthCheck
+from snaps.openstack.tests.os_source_file_test import OSIntegrationTestCase
+
 from functest.opnfv_tests.openstack.snaps.snaps_test_runner import (
     SnapsTestRunner)
 
-from snaps.openstack.tests.os_source_file_test import OSIntegrationTestCase
-from snaps.openstack.tests.create_instance_tests import SimpleHealthCheck
-
 
 class HealthCheck(SnapsTestRunner):
     """
index fa1005e..21d1dd6 100644 (file)
@@ -7,15 +7,16 @@
 #
 # http://www.apache.org/licenses/LICENSE-2.0
 
-"""Some common utils wrapping snaps functions """
+"""Some common utils wrapping snaps functions"""
+
+from snaps.openstack.tests import openstack_tests
+from snaps.openstack.utils import neutron_utils
+from snaps.openstack.utils import nova_utils
 
 from functest.utils import config
 from functest.utils import constants
 from functest.utils import env
 
-from snaps.openstack.tests import openstack_tests
-from snaps.openstack.utils import neutron_utils, nova_utils
-
 
 def get_ext_net_name(os_creds):
     """
index cb086a3..180fa0e 100644 (file)
@@ -27,10 +27,10 @@ import sys
 
 import os_client_config
 from six.moves import urllib
+from xtesting.core import robotframework
 
 from functest.utils import config
 from functest.utils import env
-from xtesting.core import robotframework
 
 __author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
 
index c5c72e0..a882003 100644 (file)
@@ -19,14 +19,7 @@ import uuid
 from cloudify_rest_client import CloudifyClient
 from cloudify_rest_client.executions import Execution
 from scp import SCPClient
-
-from functest.opnfv_tests.openstack.snaps import snaps_utils
-import functest.opnfv_tests.vnf.router.vrouter_base as vrouter_base
-from functest.opnfv_tests.vnf.router.utilvnf import Utilvnf
-from functest.utils import config
-from functest.utils import env
-from functest.utils import functest_utils
-
+import six
 from snaps.config.flavor import FlavorConfig
 from snaps.config.image import ImageConfig
 from snaps.config.keypair import KeypairConfig
@@ -36,7 +29,6 @@ from snaps.config.security_group import (
     Direction, Protocol, SecurityGroupConfig, SecurityGroupRuleConfig)
 from snaps.config.user import UserConfig
 from snaps.config.vm_inst import FloatingIpConfig, VmInstanceConfig
-
 from snaps.openstack.create_flavor import OpenStackFlavor
 from snaps.openstack.create_image import OpenStackImage
 from snaps.openstack.create_instance import OpenStackVmInstance
@@ -45,13 +37,15 @@ from snaps.openstack.create_network import OpenStackNetwork
 from snaps.openstack.create_security_group import OpenStackSecurityGroup
 from snaps.openstack.create_router import OpenStackRouter
 from snaps.openstack.create_user import OpenStackUser
-
 import snaps.openstack.utils.glance_utils as glance_utils
 from snaps.openstack.utils import keystone_utils
 
-
-import six
-
+from functest.opnfv_tests.openstack.snaps import snaps_utils
+import functest.opnfv_tests.vnf.router.vrouter_base as vrouter_base
+from functest.opnfv_tests.vnf.router.utilvnf import Utilvnf
+from functest.utils import config
+from functest.utils import env
+from functest.utils import functest_utils
 
 __author__ = "Shuya Nakama <shuya.nakama@okinawaopenlabs.org>"
 
index 2865175..31e1b91 100644 (file)
@@ -18,10 +18,10 @@ import pkg_resources
 import requests
 import yaml
 
-from functest.utils import config
 from git import Repo
 from snaps.openstack.utils import nova_utils
 
+from functest.utils import config
 
 RESULT_SPRIT_INDEX = {
     "transfer": 8,
@@ -202,12 +202,12 @@ class Utilvnf(object):  # pylint: disable=too-many-instance-attributes
 
     def request_vnf_reboot(self, vnf_info_list):
         for vnf in vnf_info_list:
-            self.logger.debug("reboot the " + vnf["vnf_name"])
+            self.logger.debug("reboot the %s", vnf["vnf_name"])
             self.reboot_vm(vnf["vnf_name"])
 
     def request_vm_delete(self, vnf_info_list):
         for vnf in vnf_info_list:
-            self.logger.debug("delete the " + vnf["vnf_name"])
+            self.logger.debug("delete the %s", vnf["vnf_name"])
             self.delete_vm(vnf["vnf_name"])
 
     def get_vnf_info_list(self, cfy_manager_ip, topology_deploy_name,
@@ -225,7 +225,7 @@ class Utilvnf(object):  # pylint: disable=too-many-instance-attributes
 
             vnf["target_vnf_flag"] = bool(vnf_name == target_vnf_name)
 
-            self.logger.debug("vnf name : " + vnf_name)
+            self.logger.debug("vnf name : %s", vnf_name)
             self.logger.debug(vnf_name + " floating ip address : " +
                               vnf["floating_ip"])
 
index 56dc1e2..79acc77 100644 (file)
@@ -124,11 +124,11 @@ class VmController(object):
     def command_list_execute(self, ssh, command_list, prompt):
         res_data_list = []
         for command in command_list:
-            self.logger.debug("Command : " + command)
+            self.logger.debug("Command : %s", command)
             (res, res_data) = self.command_execute(ssh,
                                                    command,
                                                    prompt)
-            self.logger.debug("Response : " + res_data)
+            self.logger.debug("Response : %s", res_data)
             res_data_list.append(res_data)
             if not res:
                 return res, res_data_list
@@ -140,7 +140,7 @@ class VmController(object):
     def command_execute(self, ssh, command, prompt):
         res_data = ssh.send(command, prompt)
         if res_data is None:
-            self.logger.info("retry send command : " + command)
+            self.logger.info("retry send command : %s", command)
             res_data = ssh.send(command,
                                 prompt)
             if not ssh.error_check(res_data):
index 8818032..6c4e5ce 100644 (file)
@@ -65,9 +65,9 @@ class VrouterOnBoardingBase(vnf.VnfOnBoarding):
                     test_list = function_test["test_list"]
                     target_vnf_name = function_test["target_vnf_name"]
                     for test_info in test_list:
-                        self.logger.info(test_info["protocol"] + " " +
-                                         test_info["test_kind"] +
-                                         " test.")
+                        self.logger.info(
+                            "%s %s test.", test_info["protocol"],
+                            test_info["test_kind"])
                         (result, result_data) = self.function_test_vrouter(
                             target_vnf_name, test_info)
                         test_result_data_list.append(result_data)
index d50e052..bf509cb 100644 (file)
@@ -362,6 +362,7 @@ class ODLRunTesting(ODLTesting):
     @mock.patch('os_client_config.make_shade')
     def _test_run(self, status=testcase.TestCase.EX_OK,
                   exception=None, *args, **kwargs):
+        # pylint: disable=keyword-arg-before-vararg
         args[0].return_value.search_services.return_value = [
             munch.Munch(id=self._neutron_id)]
         args[0].return_value.search_endpoints.return_value = [
@@ -393,6 +394,7 @@ class ODLRunTesting(ODLTesting):
     @mock.patch('os_client_config.make_shade')
     def _test_multiple_suites(self, suites,
                               status=testcase.TestCase.EX_OK, *args, **kwargs):
+        # pylint: disable=keyword-arg-before-vararg
         args[0].return_value.search_endpoints.return_value = [
             munch.Munch(url=self._neutron_url)]
         args[0].return_value.search_services.return_value = [
index 2f57074..eb5a413 100644 (file)
@@ -5,7 +5,7 @@ coverage!=4.4,>=4.0 # Apache-2.0
 mock>=2.0.0 # BSD
 nose>=1.3.7 # LGPL
 flake8<2.6.0,>=2.5.4 # MIT
-pylint==1.4.5 # GPLv2
+pylint # GPLv2
 sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
 sphinx-opnfv-theme
 sphinx-rtd-theme
diff --git a/tox.ini b/tox.ini
index 64ccb7b..8a2bfd7 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -75,8 +75,9 @@ modules =
   functest.utils.functest_utils
 commands =
   bash -c "\
-    pylint -f parseable --ignore-imports=y --disable=locally-disabled functest | \
-    tee pylint.out | sed -ne '/Raw metrics/,//p'"
+    pylint -f parseable \
+        --ignore-imports=y \
+        --disable=locally-disabled functest | tee pylint.out"
   pylint --reports=n --errors-only functest
   pylint --disable=locally-disabled \
     --disable=duplicate-code \