From 7478c9fafaebeab1054509fc92b2767d80c60c4d Mon Sep 17 00:00:00 2001 From: Valerii Ponomarov Date: Fri, 22 Nov 2019 22:02:02 +0530 Subject: [py2to3] Refactor gluster_base_class.py Following changes were implemented: - Delete unused imports and place used ones in the alphabetical order. Imports are splitted into 3 groups: built-ins, third-parties and local modules/libs. - Make changes to support py3 in addition to py2. - Minimize number of code lines keeping the same behaviour and improving readability. - Add possibility to get 'bound' (cls) methods using 'get_super_method' staticmethod from base class. Before it was possible to call only unbound (self) methods. - Update 'test_add_brick.py' module as PoC for running base class bound methods in both - py2 and py3. Now this module py2/3 compatible. Change-Id: I1b66b3a91084b2487c26bec8763ab2b4e12ac482 Signed-off-by: Valerii Ponomarov --- tests/functional/glusterd/test_add_brick.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/functional/glusterd/test_add_brick.py') diff --git a/tests/functional/glusterd/test_add_brick.py b/tests/functional/glusterd/test_add_brick.py index c802c79be..b8646098d 100644 --- a/tests/functional/glusterd/test_add_brick.py +++ b/tests/functional/glusterd/test_add_brick.py @@ -33,7 +33,7 @@ class TestVolumeCreate(GlusterBaseClass): def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # check whether peers are in connected state if not cls.validate_peers_are_connected(): @@ -57,7 +57,7 @@ class TestVolumeCreate(GlusterBaseClass): raise ExecutionError("Failed to delete the brick dirs.") g.log.info("Successfully cleaned all the brick dirs.") - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_add_brick_functionality(self): -- cgit