summaryrefslogtreecommitdiffstats
path: root/examples/tests_using_baseclass.py
diff options
context:
space:
mode:
authorValerii Ponomarov <vponomar@redhat.com>2019-12-18 21:21:27 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2019-12-23 12:36:55 +0000
commit517557b69cae5f6790facdbbd28d6bd597111d3e (patch)
treec1902f89ac339494879fc8a0d4f051aea2ff60e8 /examples/tests_using_baseclass.py
parent68d7bacad91349bb437b3c8cf6bbdf572562bbd3 (diff)
Fix python files in the 'examples' directory
Fix consists of following things: - Add py2/3 compatibility - Place imports into 3 different groups and reorder them alphabetically. As it is written in the "pep8" [1]. [1] https://www.python.org/dev/peps/pep-0008/ Change-Id: Iad1c6c409d2711f8c9b2d929d29072953fd49d8e Signed-off-by: Valerii Ponomarov <kiparis.kh@gmail.com>
Diffstat (limited to 'examples/tests_using_baseclass.py')
-rw-r--r--examples/tests_using_baseclass.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/examples/tests_using_baseclass.py b/examples/tests_using_baseclass.py
index 569feac83..fecd412a1 100644
--- a/examples/tests_using_baseclass.py
+++ b/examples/tests_using_baseclass.py
@@ -14,7 +14,10 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, runs_on)
+from glustolibs.gluster.gluster_base_class import (
+ GlusterBaseClass,
+ runs_on,
+)
""" Example1: Using GlusterBaseClass
"""
@@ -33,7 +36,7 @@ class TestUsingGlusterBaseClass(GlusterBaseClass):
# Calling GlusterBaseClass setUpClass. This will read all the
# Variables from the g.config and will assign values to variables to
# Use in the tests
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Add test class setup code here.
@@ -41,7 +44,7 @@ class TestUsingGlusterBaseClass(GlusterBaseClass):
"""setUp before the test
"""
# Calling GlusterBaseClass setUp
- GlusterBaseClass.setUp.im_func(self)
+ self.get_super_method(self, 'setUp')()
# Add test setup code here
@@ -60,13 +63,16 @@ class TestUsingGlusterBaseClass(GlusterBaseClass):
# Add test teardown code here
# Calling GlusterBaseClass teardown
- GlusterBaseClass.tearDown.im_func(self)
+ self.get_super_method(self, 'tearDown')()
@classmethod
def tearDownClass(cls):
"""tearDownClass. This will be executed once per class.
+
+ Define it when you need to execute something else than super's
+ tearDownClass method.
"""
# Add test class teardown code here
# Calling GlusterBaseClass tearDownClass.
- GlusterBaseClass.tearDownClass.im_func(cls)
+ cls.get_super_method(cls, 'tearDownClass')()