From fb5145be2db1a7c96b008af8a40e3b7b18df9673 Mon Sep 17 00:00:00 2001 From: Nigel Babu Date: Mon, 5 Mar 2018 15:49:23 +0530 Subject: Fix up coding style issues in tests Change-Id: I14609030983d4485dbce5a4ffed1e0353e3d1bc7 --- tests/functional/bvt/__init__.py | 0 tests/functional/bvt/test_basic.py | 4 ++-- tests/functional/bvt/test_cvt.py | 35 +++++++++++++++++------------------ tests/functional/bvt/test_vvt.py | 6 +++--- 4 files changed, 22 insertions(+), 23 deletions(-) create mode 100644 tests/functional/bvt/__init__.py (limited to 'tests/functional/bvt') diff --git a/tests/functional/bvt/__init__.py b/tests/functional/bvt/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/functional/bvt/test_basic.py b/tests/functional/bvt/test_basic.py index 54078ef44..4dbb23cb5 100644 --- a/tests/functional/bvt/test_basic.py +++ b/tests/functional/bvt/test_basic.py @@ -16,8 +16,8 @@ """ Description: BVT-Basic Tests """ -import pytest import time +import pytest from glusto.core import Glusto as g from glustolibs.gluster.gluster_base_class import GlusterBaseClass from glustolibs.gluster.exceptions import ExecutionError @@ -112,7 +112,7 @@ class TestGlusterdSanity(GlusterBaseClass): ret = restart_glusterd(self.servers) if not ret: raise ExecutionError("Failed to restart glusterd on all " - "servers %s", self.servers) + "servers %s" % self.servers) g.log.info("Successfully restarted glusterd on all servers %s", self.servers) diff --git a/tests/functional/bvt/test_cvt.py b/tests/functional/bvt/test_cvt.py index 81f692c9b..dac0fe88d 100644 --- a/tests/functional/bvt/test_cvt.py +++ b/tests/functional/bvt/test_cvt.py @@ -82,25 +82,24 @@ class GlusterBasicFeaturesSanityBaseClass(GlusterBaseClass): "file_dir_ops.py") ret = upload_scripts(cls.clients, script_local_path) if not ret: - raise ExecutionError("Failed to upload IO scripts to clients %s", + raise ExecutionError("Failed to upload IO scripts to clients %s" % cls.clients) g.log.info("Successfully uploaded IO scripts to clients %s", cls.clients) cls.counter = 1 - """int: Value of counter is used for dirname-start-num argument for - file_dir_ops.py create_deep_dirs_with_files. - - The --dir-length argument value for - file_dir_ops.py create_deep_dirs_with_files is set to 10 - (refer to the cmd in setUp method). This means every mount will create - 10 top level dirs. For every mountpoint/testcase to create new set of - dirs, we are incrementing the counter by --dir-length value i.e 10 - in this test suite. - - If we are changing the --dir-length to new value, ensure the counter - is also incremented by same value to create new set of files/dirs. - """ + # int: Value of counter is used for dirname-start-num argument for + # file_dir_ops.py create_deep_dirs_with_files. + + # The --dir-length argument value for file_dir_ops.py + # create_deep_dirs_with_files is set to 10 (refer to the cmd in setUp + # method). This means every mount will create + # 10 top level dirs. For every mountpoint/testcase to create new set of + # dirs, we are incrementing the counter by --dir-length value i.e 10 in + # this test suite. + + # If we are changing the --dir-length to new value, ensure the counter + # is also incremented by same value to create new set of files/dirs. def setUp(self): """ @@ -692,23 +691,23 @@ class TestGlusterHealSanity(GlusterBasicFeaturesSanityBaseClass): - wait for heal to complete - validate IO """ + # pylint: disable=too-many-statements # Check if volume type is dispersed. If the volume type is # dispersed, set the volume option 'disperse.optimistic-change-log' # to 'off' # Refer to: https://bugzilla.redhat.com/show_bug.cgi?id=1470938 + # pylint: disable=unsupported-membership-test if 'dispersed' in self.volume_type and 'nfs' in self.mount_type: g.log.info("Set volume option 'disperse.optimistic-change-log' " "to 'off' on a dispersed volume . " "Refer to bug: " "https://bugzilla.redhat.com/show_bug.cgi?id=1470938") ret = set_volume_options(self.mnode, self.volname, - {'disperse.optimistic-change-log': 'off'} - ) + {'disperse.optimistic-change-log': 'off'}) self.assertTrue(ret, ("Failed to set the volume option %s to " "off on volume %s", 'disperse.optimistic-change-log', - self.volname) - ) + self.volname)) g.log.info("Successfully set the volume option " "'disperse.optimistic-change-log' to 'off'") diff --git a/tests/functional/bvt/test_vvt.py b/tests/functional/bvt/test_vvt.py index 1cff6750b..8b3b69bf3 100644 --- a/tests/functional/bvt/test_vvt.py +++ b/tests/functional/bvt/test_vvt.py @@ -57,7 +57,7 @@ class VolumeAccessibilityTests(GlusterBaseClass): "file_dir_ops.py") ret = upload_scripts(cls.clients, script_local_path) if not ret: - raise ExecutionError("Failed to upload IO scripts to clients %s", + raise ExecutionError("Failed to upload IO scripts to clients %s" % cls.clients) g.log.info("Successfully uploaded IO scripts to clients %s", cls.clients) @@ -72,7 +72,7 @@ class VolumeAccessibilityTests(GlusterBaseClass): g.log.info("Starting to Setup Volume %s", self.volname) ret = self.setup_volume() if not ret: - raise ExecutionError("Failed to Setup Volume %s", self.volname) + raise ExecutionError("Failed to Setup Volume %s" % self.volname) g.log.info("Successful in Setup Volume %s", self.volname) def tearDown(self): @@ -82,7 +82,7 @@ class VolumeAccessibilityTests(GlusterBaseClass): g.log.info("Starting to Setup Volume %s", self.volname) ret = self.cleanup_volume() if not ret: - raise ExecutionError("Failed to Setup_Volume %s", self.volname) + raise ExecutionError("Failed to Setup_Volume %s" % self.volname) g.log.info("Successful in Setup Volume %s", self.volname) # Calling GlusterBaseClass tearDown -- cgit