summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValerii Ponomarov <vponomar@redhat.com>2019-11-30 01:10:19 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2019-12-09 17:59:35 +0000
commit37155292140a9ad4e19ab87cd026274893df8872 (patch)
treefe0185224e48d962e854117ab3f6c8d4b22148ee
parentcabfc95648ebb76cf7ad409cc594b3f8a131f109 (diff)
[py2to3] Add py3 support for tests in 'tests/functional/bvt'
Change-Id: I8b8aad4c3e4a2ad924478f1842498289323b7098 Signed-off-by: Valerii Ponomarov <kiparis.kh@gmail.com>
-rw-r--r--glustolibs-gluster/glustolibs/gluster/gluster_base_class.py10
-rw-r--r--tests/functional/bvt/test_basic.py4
-rw-r--r--tests/functional/bvt/test_cvt.py6
-rw-r--r--tests/functional/bvt/test_vvt.py6
4 files changed, 12 insertions, 14 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py
index 34a1fe5..5a61b86 100644
--- a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py
+++ b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py
@@ -117,12 +117,10 @@ class GlusterBaseClass(TestCase):
"""
current_type = obj if isclass(obj) else obj.__class__
- if (getattr(super(current_type, obj), method_name) != getattr(
- obj, method_name)):
- return getattr(super(current_type, obj), method_name)
- # NOTE(vponomar): we always have here just one base as 'obj' is
- # expected to be renamed copy of it's parent.
- return getattr(super(current_type.__bases__[0], obj), method_name)
+ while getattr(super(current_type, obj), method_name) == getattr(
+ obj, method_name):
+ current_type = current_type.__base__
+ return getattr(super(current_type, obj), method_name)
@classmethod
def inject_msg_in_gluster_logs(cls, msg):
diff --git a/tests/functional/bvt/test_basic.py b/tests/functional/bvt/test_basic.py
index 4dbb23c..a031850 100644
--- a/tests/functional/bvt/test_basic.py
+++ b/tests/functional/bvt/test_basic.py
@@ -32,7 +32,7 @@ class TestGlusterdSanity(GlusterBaseClass):
"""setUp required for tests
"""
# Calling GlusterBaseClass setUp
- GlusterBaseClass.setUp.im_func(self)
+ self.get_super_method(self, 'setUp')()
# Defining this variable to check if restart glusterd is required
# in teardown
@@ -128,4 +128,4 @@ class TestGlusterdSanity(GlusterBaseClass):
g.log.info("All peers are in connected state")
# Calling GlusterBaseClass tearDown
- GlusterBaseClass.tearDown.im_func(self)
+ self.get_super_method(self, 'tearDown')()
diff --git a/tests/functional/bvt/test_cvt.py b/tests/functional/bvt/test_cvt.py
index 05578b4..d774400 100644
--- a/tests/functional/bvt/test_cvt.py
+++ b/tests/functional/bvt/test_cvt.py
@@ -71,7 +71,7 @@ class GlusterBasicFeaturesSanityBaseClass(GlusterBaseClass):
"""Upload the necessary scripts to run tests.
"""
# Calling GlusterBaseClass setUpClass
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Upload io scripts for running IO on mounts
g.log.info("Upload io scripts to clients %s for running IO on "
@@ -108,7 +108,7 @@ class GlusterBasicFeaturesSanityBaseClass(GlusterBaseClass):
- IO creates deep dirs and files.
"""
# Calling GlusterBaseClass setUp
- GlusterBaseClass.setUp.im_func(self)
+ self.get_super_method(self, 'setUp')()
# Setup Volume and Mount Volume
g.log.info("Starting to Setup Volume and Mount Volume")
@@ -172,7 +172,7 @@ class GlusterBasicFeaturesSanityBaseClass(GlusterBaseClass):
g.log.info("Successful in Unmount Volume and Cleanup Volume")
# Calling GlusterBaseClass tearDown
- GlusterBaseClass.tearDown.im_func(self)
+ self.get_super_method(self, 'tearDown')()
@runs_on([['replicated', 'distributed', 'distributed-replicated',
diff --git a/tests/functional/bvt/test_vvt.py b/tests/functional/bvt/test_vvt.py
index 8b3b69b..9534f05 100644
--- a/tests/functional/bvt/test_vvt.py
+++ b/tests/functional/bvt/test_vvt.py
@@ -46,7 +46,7 @@ class VolumeAccessibilityTests(GlusterBaseClass):
"""Upload the necessary scripts to run tests.
"""
# Calling GlusterBaseClass setUpClass
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Upload io scripts for running IO on mounts
g.log.info("Upload io scripts to clients %s for running IO on "
@@ -66,7 +66,7 @@ class VolumeAccessibilityTests(GlusterBaseClass):
"""Setup Volume
"""
# Calling GlusterBaseClass setUp
- GlusterBaseClass.setUp.im_func(self)
+ self.get_super_method(self, 'setUp')()
# Setup_Volume
g.log.info("Starting to Setup Volume %s", self.volname)
@@ -86,7 +86,7 @@ class VolumeAccessibilityTests(GlusterBaseClass):
g.log.info("Successful in Setup Volume %s", self.volname)
# Calling GlusterBaseClass tearDown
- GlusterBaseClass.tearDown.im_func(self)
+ self.get_super_method(self, 'tearDown')()
@pytest.mark.bvt_vvt
def test_volume_create_start_stop_start(self):