--- tests/upgradepath/upgradepath.py | 44 ++++++++++++------------------------- 1 files changed, 14 insertions(+), 30 deletions(-)
diff --git a/tests/upgradepath/upgradepath.py b/tests/upgradepath/upgradepath.py index 257eddc..a49fa07 100755 --- a/tests/upgradepath/upgradepath.py +++ b/tests/upgradepath/upgradepath.py @@ -36,17 +36,11 @@ from autotest_lib.client.common_lib import error
class upgradepath(AutoQATest): version = 1 # increment if setup() changes - test_result = 'PASS' - log = [] - envr_list = set()
- def initialize(self, config): - self.config = config_loader(config, self.tmpdir) - #URL of logs/results stored on autotest-server - self.autotest_url = autoqa.util.make_autotest_url(self.config) - - def setup(self): - pass + def __init__(self, *args, **kwargs): + super(upgradepath, self).__init__(*args, **kwargs) + self.log = [] + self.envr_list = set()
def compare(self, matching_build, tags, op): koji = autoqa.koji_utils.SimpleKojiClientSession() @@ -68,7 +62,7 @@ class upgradepath(AutoQATest): print msg self.log.append(msg) else: - self.test_result = 'FAIL' + self.result = 'FAILED' msg ='{0:<7}{1}'.format('[FAIL]', tag) print msg self.log.append(msg) @@ -85,11 +79,11 @@ class upgradepath(AutoQATest): try: current_tag = repotags.index(kojitag) except ValueError: - self.test_result = 'FAIL' - msg = "ERROR: Entered bad kojitag" - print msg - self.log.append(msg) - self.envr_list.add(matching_build['envr']) + self.result = 'FAILED' + self.summary = "ERROR: Entered bad kojitag" + print self.summary + self.log.append(self.summary) + self.outputs = "\n".join(self.log) raise error.TestFail
hi_tags = repotags[(current_tag + 1):] # tags higher than current @@ -136,20 +130,10 @@ class upgradepath(AutoQATest): self.log.append(msg) print msg
- self.result = self.test_result - self.outputs = "" - for i in self.log: - self.outputs += i + '\n' - - self.outputs += '\n \n' - - packages_fail = "" - for i in self.envr_list: - packages_fail += i + ', ' - packages_fail = packages_fail[:-2] - - self.summary = packages_fail + self.outputs = "\n".join(self.log) + self.summary = ", ".join(self.envr_list)
- if self.test_result == 'FAIL': + if self.result == 'FAILED': raise error.TestFail + self.result = "PASSED"
This patch looks OK, with one comment:
On Tue, 2010-08-31 at 13:07 +0200, Josef Skladanka wrote:
- def initialize(self, config):
self.config = config_loader(config, self.tmpdir)
#URL of logs/results stored on autotest-server
self.autotest_url = autoqa.util.make_autotest_url(self.config)
- def setup(self):
pass
- def __init__(self, *args, **kwargs):
super(upgradepath, self).__init__(*args, **kwargs)
self.log = []
self.envr_list = set()
This is kind of confusing - is there a reason you need to use __init__() and not initialize(), as suggested by the test template? For example:
def initialize(self, *args, **kwargs): super(upgradepath, self).initialize(config) self.log = [] self.envr_list = set()
Even simpler - why not just set self.log and self.envr_list at the top of run_once()? Then you don't have to worry about running super(...) at all.
-w
autoqa-devel@lists.fedorahosted.org