Fix flake8 errors 69/6569/1
authorJo¶rgen Karlsson <jorgen.w.karlsson@ericsson.com>
Wed, 13 Jan 2016 15:19:58 +0000 (16:19 +0100)
committerJörgen Karlsson <jorgen.w.karlsson@ericsson.com>
Wed, 13 Jan 2016 16:48:17 +0000 (16:48 +0000)
Change-Id: I14f21092f5e97abf0629a92a27062846a6d3130b
JIRA:-
Signed-off-by: Jo¶rgen Karlsson <jorgen.w.karlsson@ericsson.com>
(cherry picked from commit 791323df72d8bf4f4f4c32a1e7273721f2adc349)

16 files changed:
yardstick/__init__.py
yardstick/benchmark/runners/arithmetic.py
yardstick/benchmark/runners/base.py
yardstick/benchmark/scenarios/networking/ping.py
yardstick/benchmark/scenarios/networking/ping6.py
yardstick/cmd/cli.py
yardstick/common/template_format.py
yardstick/vTC/apexlake/experimental_framework/heat_manager.py
yardstick/vTC/apexlake/tests/benchmarking_unit_test.py
yardstick/vTC/apexlake/tests/common_test.py
yardstick/vTC/apexlake/tests/conf_file_sections_test.py
yardstick/vTC/apexlake/tests/deployment_unit_test.py
yardstick/vTC/apexlake/tests/generates_template_test.py
yardstick/vTC/apexlake/tests/heat_manager_test.py
yardstick/vTC/apexlake/tests/multi_tenancy_throughput_benchmark_test.py
yardstick/vTC/apexlake/tests/tree_node_test.py

index 7114f80..c31948d 100644 (file)
@@ -9,6 +9,13 @@
 
 import logging
 import logging.config
+import sys
+import os
+import yardstick.vTC.apexlake as apexlake
+
+# Hack to be able to run apexlake unit tests
+# without having to install apexlake.
+sys.path.append(os.path.dirname(apexlake.__file__))
 
 logging.basicConfig(
     level=logging.WARNING,
@@ -16,10 +23,3 @@ logging.basicConfig(
         '%(levelname)s %(message)s',  # noqa
     datefmt='%m/%d/%y %H:%M:%S')
 logging.getLogger(__name__).setLevel(logging.INFO)
-
-# Hack to be able to run apexlake unit tests
-# without having to install apexlake.
-import sys
-import os
-import yardstick.vTC.apexlake as apexlake
-sys.path.append(os.path.dirname(apexlake.__file__))
index 7e516ea..035f9e2 100755 (executable)
@@ -58,7 +58,8 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
         sla_action = scenario_cfg["sla"].get("action", "assert")
 
     # To both be able to include the stop value and handle backwards stepping
-    margin = lambda start, stop: -1 if start > stop else 1
+    def margin(start, stop):
+        return -1 if start > stop else 1
 
     param_iters = \
         [xrange(d['start'], d['stop'] + margin(d['start'], d['stop']),
index 9925ace..56a394e 100755 (executable)
@@ -14,14 +14,14 @@ import subprocess
 import time
 import traceback
 
-log = logging.getLogger(__name__)
-
 from oslo_config import cfg
 
 import yardstick.common.utils as utils
 from yardstick.benchmark.scenarios import base as base_scenario
 from yardstick.dispatcher.base import Base as DispatcherBase
 
+log = logging.getLogger(__name__)
+
 CONF = cfg.CONF
 
 
index c62c79e..fc41766 100644 (file)
@@ -72,8 +72,8 @@ class Ping(base.Scenario):
 
             if "sla" in self.scenario_cfg:
                 sla_max_rtt = int(self.scenario_cfg["sla"]["max_rtt"])
-                assert result["rtt"] <= sla_max_rtt, "rtt %f > sla:max_rtt(%f); " % \
-                    (result["rtt"], sla_max_rtt)
+                assert result["rtt"] <= sla_max_rtt, \
+                    "rtt %f > sla:max_rtt(%f); " % (result["rtt"], sla_max_rtt)
         else:
             LOG.error("ping '%s' '%s' timeout", options, destination)
 
index 629f62b..5d878eb 100644 (file)
@@ -90,8 +90,8 @@ class Ping6(base.Scenario):  # pragma: no cover
 
             if "sla" in self.scenario_cfg:
                 sla_max_rtt = int(self.scenario_cfg["sla"]["max_rtt"])
-                assert result["rtt"] <= sla_max_rtt, "rtt %f > sla:max_rtt(%f); " % \
-                    (result["rtt"], sla_max_rtt)
+                assert result["rtt"] <= sla_max_rtt, \
+                    "rtt %f > sla:max_rtt(%f); " % (result["rtt"], sla_max_rtt)
         else:
             LOG.error("ping6 timeout")
         self.run_done = True
index 1f058a5..8d75d7d 100644 (file)
@@ -101,8 +101,9 @@ class YardstickCLI():
         '''run the command line interface'''
 
         # register subcommands to parse additional command line arguments
-        parser = lambda subparsers: self._add_command_parsers(
-            YardstickCLI.categories, subparsers)
+        def parser(subparsers):
+            self._add_command_parsers(YardstickCLI.categories, subparsers)
+
         category_opt = cfg.SubCommandOpt("category",
                                          title="Command categories",
                                          help="Available categories",
index 881b7e4..2deaf39 100644 (file)
@@ -56,8 +56,8 @@ def parse(tmpl_str):
             if tpl is None:
                 tpl = {}
     # Looking for supported version keys in the loaded template
-    if not ('HeatTemplateFormatVersion' in tpl
-            or 'heat_template_version' in tpl
-            or 'AWSTemplateFormatVersion' in tpl):
+    if not ('HeatTemplateFormatVersion' in tpl or
+            'heat_template_version' in tpl or
+            'AWSTemplateFormatVersion' in tpl):
         raise ValueError("Template format version not found.")
     return tpl
index 607fa77..28c069f 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-__author__ = 'vmriccox'
-
-
 from keystoneclient.v2_0 import client as keystoneClient
 from heatclient import client as heatClient
 from heatclient.common import template_utils
 
 import experimental_framework.common as common
 
+__author__ = 'vmriccox'
+
 
 class HeatManager:
 
index ccf6406..652327a 100644 (file)
@@ -12,9 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-__author__ = 'vmriccox'
-
-
 import unittest
 import mock
 from experimental_framework.benchmarking_unit import BenchmarkingUnit
@@ -24,6 +21,8 @@ import experimental_framework.common as common
 from experimental_framework.benchmarks.rfc2544_throughput_benchmark import \
     RFC2544ThroughputBenchmark
 
+__author__ = 'vmriccox'
+
 
 # class DummyDataManager(DataManager):
 #
index 293754b..19b2a0e 100644 (file)
@@ -1,5 +1,3 @@
-__author__ = 'vmricco'
-
 import unittest
 import mock
 import os
@@ -8,6 +6,8 @@ import ConfigParser
 import experimental_framework.common as common
 import experimental_framework.constants.conf_file_sections as cf
 
+__author__ = 'vmricco'
+
 
 def reset_common():
     common.LOG = None
index d2157fc..3266ce6 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-__author__ = 'vmriccox'
-
-
 import unittest
 from experimental_framework.constants import conf_file_sections as cfs
 
+__author__ = 'vmriccox'
+
 
 class TestConfFileSection(unittest.TestCase):
 
index 46b3283..8117167 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-__author__ = 'vmriccox'
-
-
 import unittest
 import mock
 import experimental_framework.deployment_unit as mut
 
+__author__ = 'vmriccox'
+
 
 class DummyHeatManager:
 
index f4525a2..dad3177 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-__author__ = 'gpetralx'
-
-
 import unittest
 import experimental_framework.heat_template_generation as heat_gen
 import mock
 import os
 import experimental_framework.common as common
 
+__author__ = 'gpetralx'
+
 
 def reset_common():
     common.LOG = None
index a2798a7..f1d3d00 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-__author__ = 'gpetralx'
-
-
 import unittest
 from experimental_framework import heat_manager
 import mock
 
+__author__ = 'gpetralx'
+
 
 def get_mock_heat(version, *args, **kwargs):
     return MockHeat()
index babf04a..6544fea 100644 (file)
@@ -12,9 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-__author__ = 'gpetralx'
-
-
 import unittest
 import mock
 import os
@@ -22,6 +19,8 @@ import experimental_framework.common as common
 from experimental_framework.benchmarks \
     import multi_tenancy_throughput_benchmark as bench
 
+__author__ = 'gpetralx'
+
 
 class MockDeploymentUnit(object):
     def deploy_heat_template(self, temp_file, stack_name, heat_param):
index 8b302c9..e51343f 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-__author__ = 'gpetralx'
-
-
 import unittest
 import experimental_framework.heat_template_generation as heat_gen
 
+__author__ = 'gpetralx'
+
 
 class TestTreeNode(unittest.TestCase):
     def setUp(self):