This simplifies the test object template and our tests, it is no longer necessary to update class names in super() calls in run_once and initialize methods. --- doc/test_class.py.template | 4 ++-- tests/conflicts/conflicts.py | 2 +- tests/helloworld/helloworld.py | 2 +- tests/initscripts/initscripts.py | 4 ++-- tests/rats_install/rats_install.py | 4 ++-- tests/rats_sanity/rats_sanity.py | 4 ++-- tests/repoclosure/repoclosure.py | 2 +- tests/rpmguard/rpmguard.py | 4 ++-- tests/rpmlint/rpmlint.py | 4 ++-- tests/upgradepath/upgradepath.py | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/doc/test_class.py.template b/doc/test_class.py.template index c19074a..e5823ac 100644 --- a/doc/test_class.py.template +++ b/doc/test_class.py.template @@ -53,7 +53,7 @@ class testclassname(AutoQATest): # <-- UPDATE class name # method - if you don't need to initialize anything, delete this block. #@ExceptionCatcher() #def initialize(self, config, **kwargs): #**kwargs needs to stay - # super(testclassname, self).initialize(config) # <-- UPDATE class name + # super(self.__class__, self).initialize(config) # #your extra initialization code goes here
# This is where the test code actually gets run. It's the only required @@ -65,7 +65,7 @@ class testclassname(AutoQATest): # <-- UPDATE class name # self.highlights: important lines to notice (string or list of strings) @ExceptionCatcher() def run_once(self, some_params, **kwargs): #**kwargs needs to stay - super(testclassname, self).run_once() # <-- UPDATE class name + super(self.__class__, self).run_once() cmd = 'test_binary --param %s' % some_params self.outputs = utils.system_output(cmd, retain_output=True)
diff --git a/tests/conflicts/conflicts.py b/tests/conflicts/conflicts.py index c9a4667..d77f507 100644 --- a/tests/conflicts/conflicts.py +++ b/tests/conflicts/conflicts.py @@ -34,7 +34,7 @@ class conflicts(AutoQATest):
@ExceptionCatcher() def run_once(self, baseurl, parents, name, **kwargs): - super(conflicts, self).run_once() + super(self.__class__, self).run_once() if name: name = "%s-%s" % (name, autoqa.util.get_basearch()) else: diff --git a/tests/helloworld/helloworld.py b/tests/helloworld/helloworld.py index 1a96ef5..5422ae3 100644 --- a/tests/helloworld/helloworld.py +++ b/tests/helloworld/helloworld.py @@ -25,7 +25,7 @@ class helloworld(AutoQATest):
@ExceptionCatcher() def run_once(self, *args, **kwargs): - super(helloworld, self).run_once() + super(self.__class__, self).run_once() self.summary = 'Hello, World!' self.outputs = "===Printing passed params===\n" for arg in args: diff --git a/tests/initscripts/initscripts.py b/tests/initscripts/initscripts.py index a5d22f3..51462c9 100644 --- a/tests/initscripts/initscripts.py +++ b/tests/initscripts/initscripts.py @@ -48,7 +48,7 @@ class initscripts(AutoQATest):
@ExceptionCatcher() def initialize(self, config, **kwargs): - super(initscripts, self).initialize(config) + super(self.__class__, self).initialize(config) self.rpmdir = os.path.join(self.tmpdir, 'rpms') os.makedirs(self.rpmdir)
@@ -102,7 +102,7 @@ class initscripts(AutoQATest):
@ExceptionCatcher() def run_once(self, kojitag, **kwargs): - super(initscripts, self).run_once() + super(self.__class__, self).run_once() if kwargs['hook'] == 'post-koji-build': envrs = [kwargs['envr']] update_id = kwargs['envr'] diff --git a/tests/rats_install/rats_install.py b/tests/rats_install/rats_install.py index 23c2015..4ed010f 100644 --- a/tests/rats_install/rats_install.py +++ b/tests/rats_install/rats_install.py @@ -31,7 +31,7 @@ class rats_install(AutoQATest):
@ExceptionCatcher() def initialize(self, config, **kwargs): - super(rats_install, self).initialize(config) + super(self.__class__, self).initialize(config) self.irb_conf = os.path.join(self.bindir, 'irb.cfg')
@ExceptionCatcher() @@ -52,7 +52,7 @@ class rats_install(AutoQATest):
@ExceptionCatcher() def run_once(self, baseurl, name, image_url="", boot_args="", **kwargs): - super(rats_install, self).run_once() + super(self.__class__, self).run_once() if name: name = "%s-%s" % (name, util.get_basearch()) else: diff --git a/tests/rats_sanity/rats_sanity.py b/tests/rats_sanity/rats_sanity.py index 19116ef..de704b8 100644 --- a/tests/rats_sanity/rats_sanity.py +++ b/tests/rats_sanity/rats_sanity.py @@ -30,7 +30,7 @@ class rats_sanity(AutoQATest):
@ExceptionCatcher() def initialize(self, config, **kwargs): - super(rats_sanity, self).initialize(config) + super(self.__class__, self).initialize(config) self.irb_conf = os.path.join(self.bindir, 'irb.cfg')
@ExceptionCatcher() @@ -40,7 +40,7 @@ class rats_sanity(AutoQATest):
@ExceptionCatcher() def run_once(self, baseurl, parents, name, **kwargs): - super(rats_install, self).run_once() + super(self.__class__, self).run_once() if name: name = "%s-%s" % (name, util.get_basearch()) else: diff --git a/tests/repoclosure/repoclosure.py b/tests/repoclosure/repoclosure.py index f167722..eb5a914 100644 --- a/tests/repoclosure/repoclosure.py +++ b/tests/repoclosure/repoclosure.py @@ -31,7 +31,7 @@ class repoclosure(AutoQATest):
@ExceptionCatcher() def run_once(self, baseurl, parents='', name='', **kwargs): - super(repoclosure, self).run_once() + super(self.__class__, self).run_once() if name: name = "%s-%s" % (name, autoqa.util.get_basearch()) else: diff --git a/tests/rpmguard/rpmguard.py b/tests/rpmguard/rpmguard.py index afc4ca3..faba8e0 100644 --- a/tests/rpmguard/rpmguard.py +++ b/tests/rpmguard/rpmguard.py @@ -37,14 +37,14 @@ class rpmguard(AutoQATest):
@ExceptionCatcher() def initialize(self, config, **kwargs): - super(rpmguard, self).initialize(config) + super(self.__class__, self).initialize(config) self.rpmguard = os.path.join(self.bindir, 'rpmguard') self.rpmdir = os.path.join(self.tmpdir, 'rpms') os.makedirs(self.rpmdir)
@ExceptionCatcher() def run_once(self, kojitag, **kwargs): - super(rpmguard, self).run_once() + super(self.__class__, self).run_once() if kwargs['hook'] == 'post-koji-build': envrs = [kwargs['envr']] update_id = kwargs['envr'] diff --git a/tests/rpmlint/rpmlint.py b/tests/rpmlint/rpmlint.py index b2f5515..b1ebb35 100644 --- a/tests/rpmlint/rpmlint.py +++ b/tests/rpmlint/rpmlint.py @@ -38,13 +38,13 @@ class rpmlint(AutoQATest):
@ExceptionCatcher() def initialize(self, config, **kwargs): - super(rpmlint, self).initialize(config) + super(self.__class__, self).initialize(config) self.rpmdir = os.path.join(self.tmpdir, 'rpms') os.makedirs(self.rpmdir)
@ExceptionCatcher() def run_once(self, kojitag, **kwargs): - super(rpmlint, self).run_once() + super(self.__class__, self).run_once() if kwargs['hook'] == 'post-koji-build': envrs = [kwargs['envr']] update_id = kwargs['envr'] diff --git a/tests/upgradepath/upgradepath.py b/tests/upgradepath/upgradepath.py index a99ac2f..15e5c38 100755 --- a/tests/upgradepath/upgradepath.py +++ b/tests/upgradepath/upgradepath.py @@ -30,7 +30,7 @@ class upgradepath(AutoQATest):
@ExceptionCatcher() def initialize(self, config, **kwargs): - super(upgradepath, self).initialize(config) + super(self.__class__, self).initialize(config) self.result = 'PASSED' # order for evaluation of final result; higher index means preference self.result_order = ('PASSED','INFO','FAILED','ABORTED') @@ -86,7 +86,7 @@ class upgradepath(AutoQATest):
@ExceptionCatcher() def run_once(self, envrs, kojitag, **kwargs): - super(upgradepath, self).run_once() + super(self.__class__, self).run_once() update_id = kwargs['name'] or kwargs['id']
# Get a list of all repos we monitor (currently not -testing)
On Mon, 2011-01-10 at 14:21 +0100, Kamil Páral wrote:
This simplifies the test object template and our tests, it is no longer necessary to update class names in super() calls in run_once and initialize methods.
Nice improvement, ACK
Thanks, James
doc/test_class.py.template | 4 ++-- tests/conflicts/conflicts.py | 2 +- tests/helloworld/helloworld.py | 2 +- tests/initscripts/initscripts.py | 4 ++-- tests/rats_install/rats_install.py | 4 ++-- tests/rats_sanity/rats_sanity.py | 4 ++-- tests/repoclosure/repoclosure.py | 2 +- tests/rpmguard/rpmguard.py | 4 ++-- tests/rpmlint/rpmlint.py | 4 ++-- tests/upgradepath/upgradepath.py | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/doc/test_class.py.template b/doc/test_class.py.template index c19074a..e5823ac 100644 --- a/doc/test_class.py.template +++ b/doc/test_class.py.template @@ -53,7 +53,7 @@ class testclassname(AutoQATest): # <-- UPDATE class name # method - if you don't need to initialize anything, delete this block. #@ExceptionCatcher() #def initialize(self, config, **kwargs): #**kwargs needs to stay
- # super(testclassname, self).initialize(config) # <-- UPDATE class name
# super(self.__class__, self).initialize(config) # #your extra initialization code goes here
# This is where the test code actually gets run. It's the only required
@@ -65,7 +65,7 @@ class testclassname(AutoQATest): # <-- UPDATE class name # self.highlights: important lines to notice (string or list of strings) @ExceptionCatcher() def run_once(self, some_params, **kwargs): #**kwargs needs to stay
super(testclassname, self).run_once() # <-- UPDATE class name
super(self.__class__, self).run_once() cmd = 'test_binary --param %s' % some_params self.outputs = utils.system_output(cmd, retain_output=True)
diff --git a/tests/conflicts/conflicts.py b/tests/conflicts/conflicts.py index c9a4667..d77f507 100644 --- a/tests/conflicts/conflicts.py +++ b/tests/conflicts/conflicts.py @@ -34,7 +34,7 @@ class conflicts(AutoQATest):
@ExceptionCatcher() def run_once(self, baseurl, parents, name, **kwargs):
super(conflicts, self).run_once()
super(self.__class__, self).run_once() if name: name = "%s-%s" % (name, autoqa.util.get_basearch()) else:
diff --git a/tests/helloworld/helloworld.py b/tests/helloworld/helloworld.py index 1a96ef5..5422ae3 100644 --- a/tests/helloworld/helloworld.py +++ b/tests/helloworld/helloworld.py @@ -25,7 +25,7 @@ class helloworld(AutoQATest):
@ExceptionCatcher() def run_once(self, *args, **kwargs):
super(helloworld, self).run_once()
super(self.__class__, self).run_once() self.summary = 'Hello, World!' self.outputs = "===Printing passed params===\n" for arg in args:
diff --git a/tests/initscripts/initscripts.py b/tests/initscripts/initscripts.py index a5d22f3..51462c9 100644 --- a/tests/initscripts/initscripts.py +++ b/tests/initscripts/initscripts.py @@ -48,7 +48,7 @@ class initscripts(AutoQATest):
@ExceptionCatcher() def initialize(self, config, **kwargs):
super(initscripts, self).initialize(config)
super(self.__class__, self).initialize(config) self.rpmdir = os.path.join(self.tmpdir, 'rpms') os.makedirs(self.rpmdir)
@@ -102,7 +102,7 @@ class initscripts(AutoQATest):
@ExceptionCatcher() def run_once(self, kojitag, **kwargs):
super(initscripts, self).run_once()
super(self.__class__, self).run_once() if kwargs['hook'] == 'post-koji-build': envrs = [kwargs['envr']] update_id = kwargs['envr']
diff --git a/tests/rats_install/rats_install.py b/tests/rats_install/rats_install.py index 23c2015..4ed010f 100644 --- a/tests/rats_install/rats_install.py +++ b/tests/rats_install/rats_install.py @@ -31,7 +31,7 @@ class rats_install(AutoQATest):
@ExceptionCatcher() def initialize(self, config, **kwargs):
super(rats_install, self).initialize(config)
super(self.__class__, self).initialize(config) self.irb_conf = os.path.join(self.bindir, 'irb.cfg')
@ExceptionCatcher()
@@ -52,7 +52,7 @@ class rats_install(AutoQATest):
@ExceptionCatcher() def run_once(self, baseurl, name, image_url="", boot_args="", **kwargs):
super(rats_install, self).run_once()
super(self.__class__, self).run_once() if name: name = "%s-%s" % (name, util.get_basearch()) else:
diff --git a/tests/rats_sanity/rats_sanity.py b/tests/rats_sanity/rats_sanity.py index 19116ef..de704b8 100644 --- a/tests/rats_sanity/rats_sanity.py +++ b/tests/rats_sanity/rats_sanity.py @@ -30,7 +30,7 @@ class rats_sanity(AutoQATest):
@ExceptionCatcher() def initialize(self, config, **kwargs):
super(rats_sanity, self).initialize(config)
super(self.__class__, self).initialize(config) self.irb_conf = os.path.join(self.bindir, 'irb.cfg')
@ExceptionCatcher()
@@ -40,7 +40,7 @@ class rats_sanity(AutoQATest):
@ExceptionCatcher() def run_once(self, baseurl, parents, name, **kwargs):
super(rats_install, self).run_once()
super(self.__class__, self).run_once() if name: name = "%s-%s" % (name, util.get_basearch()) else:
diff --git a/tests/repoclosure/repoclosure.py b/tests/repoclosure/repoclosure.py index f167722..eb5a914 100644 --- a/tests/repoclosure/repoclosure.py +++ b/tests/repoclosure/repoclosure.py @@ -31,7 +31,7 @@ class repoclosure(AutoQATest):
@ExceptionCatcher() def run_once(self, baseurl, parents='', name='', **kwargs):
super(repoclosure, self).run_once()
super(self.__class__, self).run_once() if name: name = "%s-%s" % (name, autoqa.util.get_basearch()) else:
diff --git a/tests/rpmguard/rpmguard.py b/tests/rpmguard/rpmguard.py index afc4ca3..faba8e0 100644 --- a/tests/rpmguard/rpmguard.py +++ b/tests/rpmguard/rpmguard.py @@ -37,14 +37,14 @@ class rpmguard(AutoQATest):
@ExceptionCatcher() def initialize(self, config, **kwargs):
super(rpmguard, self).initialize(config)
super(self.__class__, self).initialize(config) self.rpmguard = os.path.join(self.bindir, 'rpmguard') self.rpmdir = os.path.join(self.tmpdir, 'rpms') os.makedirs(self.rpmdir)
@ExceptionCatcher() def run_once(self, kojitag, **kwargs):
super(rpmguard, self).run_once()
super(self.__class__, self).run_once() if kwargs['hook'] == 'post-koji-build': envrs = [kwargs['envr']] update_id = kwargs['envr']
diff --git a/tests/rpmlint/rpmlint.py b/tests/rpmlint/rpmlint.py index b2f5515..b1ebb35 100644 --- a/tests/rpmlint/rpmlint.py +++ b/tests/rpmlint/rpmlint.py @@ -38,13 +38,13 @@ class rpmlint(AutoQATest):
@ExceptionCatcher() def initialize(self, config, **kwargs):
super(rpmlint, self).initialize(config)
super(self.__class__, self).initialize(config) self.rpmdir = os.path.join(self.tmpdir, 'rpms') os.makedirs(self.rpmdir)
@ExceptionCatcher() def run_once(self, kojitag, **kwargs):
super(rpmlint, self).run_once()
super(self.__class__, self).run_once() if kwargs['hook'] == 'post-koji-build': envrs = [kwargs['envr']] update_id = kwargs['envr']
diff --git a/tests/upgradepath/upgradepath.py b/tests/upgradepath/upgradepath.py index a99ac2f..15e5c38 100755 --- a/tests/upgradepath/upgradepath.py +++ b/tests/upgradepath/upgradepath.py @@ -30,7 +30,7 @@ class upgradepath(AutoQATest):
@ExceptionCatcher() def initialize(self, config, **kwargs):
super(upgradepath, self).initialize(config)
super(self.__class__, self).initialize(config) self.result = 'PASSED' # order for evaluation of final result; higher index means preference self.result_order = ('PASSED','INFO','FAILED','ABORTED')
@@ -86,7 +86,7 @@ class upgradepath(AutoQATest):
@ExceptionCatcher() def run_once(self, envrs, kojitag, **kwargs):
super(upgradepath, self).run_once()
super(self.__class__, self).run_once() update_id = kwargs['name'] or kwargs['id'] # Get a list of all repos we monitor (currently not -testing)
----- Original Message -----
On Mon, 2011-01-10 at 14:21 +0100, Kamil Páral wrote:
This simplifies the test object template and our tests, it is no longer necessary to update class names in super() calls in run_once and initialize methods.
Nice improvement, ACK
Thanks, pushed to master. Wiki documentation updated: https://fedoraproject.org/w/index.php?title=Writing_AutoQA_Tests&diff=21...
autoqa-devel@lists.fedorahosted.org