diff options
author | Richard Elias <richardx.elias@intel.com> | 2018-02-28 16:16:31 +0000 |
---|---|---|
committer | Richard Elias <richardx.elias@intel.com> | 2018-03-23 14:24:03 +0000 |
commit | 184b72f6b706036aeda88d52ecb0e0c27b1573fe (patch) | |
tree | 04e0762dd89f26f55aa11a345f2b4ff02cb96aef /testcases/testcase.py | |
parent | 82a17a3d7c59a49105d6f3b2e4044ab19f77b0a0 (diff) |
python: Pylint 1.8.2 code conformity
Updated master Python scripts to conform to the newer pylint
1.8.2 standard.
JIRA: VSPERF-563
Change-Id: I19305a008a2e22c2f4841aa83fed85fbdc2d549c
Signed-off-by: Richard Elias <richardx.elias@intel.com>
Reviewed-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Christian Trautman <ctrautma@redhat.com>
Reviewed-by: Sridhar Rao <sridhar.rao@spirent.com>
Diffstat (limited to 'testcases/testcase.py')
-rw-r--r-- | testcases/testcase.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/testcases/testcase.py b/testcases/testcase.py index 18c3186c..f28519fa 100644 --- a/testcases/testcase.py +++ b/testcases/testcase.py @@ -287,7 +287,7 @@ class TestCase(object): # cleanup any namespaces created if os.path.isdir('/tmp/namespaces'): namespace_list = os.listdir('/tmp/namespaces') - if len(namespace_list): + if namespace_list: self._logger.info('Cleaning up namespaces') for name in namespace_list: namespace.delete_namespace(name) @@ -295,7 +295,7 @@ class TestCase(object): # cleanup any veth ports created if os.path.isdir('/tmp/veth'): veth_list = os.listdir('/tmp/veth') - if len(veth_list): + if veth_list: self._logger.info('Cleaning up veth ports') for eth in veth_list: port1, port2 = eth.split('-') @@ -322,8 +322,8 @@ class TestCase(object): if len(self._tc_results) < len(results): if len(self._tc_results) > 1: raise RuntimeError('Testcase results do not match:' - 'results: {}\n' - 'trafficgen results: {}\n', + 'results: %s\n' + 'trafficgen results: %s\n' % self._tc_results, results) else: @@ -379,7 +379,7 @@ class TestCase(object): self._testcase_run_time = time.strftime("%H:%M:%S", time.gmtime(self._testcase_stop_time - self._testcase_start_time)) - logging.info("Testcase execution time: " + self._testcase_run_time) + logging.info("Testcase execution time: %s", self._testcase_run_time) # report test results self.run_report() @@ -562,7 +562,7 @@ class TestCase(object): """ with open(output, 'a') as csvfile: - logging.info("Write results to file: " + output) + logging.info("Write results to file: %s", output) fieldnames = TestCase._get_unique_keys(results) writer = csv.DictWriter(csvfile, fieldnames) @@ -720,7 +720,7 @@ class TestCase(object): self._logger.debug("Skipping %s as it isn't a configuration " "parameter.", '${}'.format(macro[0])) return param - elif isinstance(param, list) or isinstance(param, tuple): + elif isinstance(param, (list, tuple)): tmp_list = [] for item in param: tmp_list.append(self.step_eval_param(item, step_result)) @@ -758,9 +758,6 @@ class TestCase(object): # initialize list with results self._step_result = [None] * len(self.test) - # We have to suppress pylint report, because test_object has to be set according - # to the test step definition - # pylint: disable=redefined-variable-type # run test step by step... for i, step in enumerate(self.test): step_ok = not self._step_check |