Merge lp:~eeejay/mago/tweaks into lp:~mago-contributors/mago/mago-1.0

Proposed by Eitan Isaacson
Status: Merged
Merged at revision: not available
Proposed branch: lp:~eeejay/mago/tweaks
Merge into: lp:~mago-contributors/mago/mago-1.0
Diff against target: None lines
To merge this branch: bzr merge lp:~eeejay/mago/tweaks
Reviewer Review Type Date Requested Status
Ara Pulido Approve
Review via email: mp+6205@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ara Pulido (ara) wrote :

The hierarchy with TestRunner -- TestSuiteRunnre, TestcaseRunner proved as a good design decision ;-)
Approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/ubuntu-desktop-test'
--- bin/ubuntu-desktop-test 2009-04-29 15:08:39 +0000
+++ bin/ubuntu-desktop-test 2009-05-05 09:08:13 +0000
@@ -308,6 +308,14 @@
308class TestRunner:308class TestRunner:
309 def __init__(self):309 def __init__(self):
310 self.result = {}310 self.result = {}
311 self.args = {}
312
313 def get_args(self, node):
314 for n in node.childNodes:
315 if n.nodeType != n.ELEMENT_NODE or not n.hasChildNodes():
316 continue
317 self.args[n.tagName.encode('ascii')] = n.firstChild.data
318
311 def add_results_to_node(self, node):319 def add_results_to_node(self, node):
312 if self.result == {}: return320 if self.result == {}: return
313 result = node.ownerDocument.createElement("result")321 result = node.ownerDocument.createElement("result")
@@ -344,19 +352,12 @@
344 def __init__(self, obj, xml_node):352 def __init__(self, obj, xml_node):
345 TestRunner.__init__(self)353 TestRunner.__init__(self)
346 self.xml_node = xml_node354 self.xml_node = xml_node
347 self.args = {}
348 self.name = xml_node.getAttribute('name')355 self.name = xml_node.getAttribute('name')
349 self.test_func = getattr(356 self.test_func = getattr(
350 obj, xml_node.getElementsByTagName('method')[0].firstChild.data)357 obj, xml_node.getElementsByTagName('method')[0].firstChild.data)
351 args_element = xml_node.getElementsByTagName('args')358 args_element = xml_node.getElementsByTagName('args')
352 if args_element:359 if args_element:
353 self._get_args(args_element[0])360 self.get_args(args_element[0])
354
355 def _get_args(self, node):
356 for n in node.childNodes:
357 if n.nodeType != n.ELEMENT_NODE or not n.hasChildNodes():
358 continue
359 self.args[n.tagName.encode('ascii')] = n.firstChild.data
360361
361 def run(self, logger):362 def run(self, logger):
362 starttime = time()363 starttime = time()
@@ -411,9 +412,12 @@
411 continue412 continue
412 if node.tagName == 'class':413 if node.tagName == 'class':
413 modname, clsname = node.firstChild.data.rsplit('.', 1)414 modname, clsname = node.firstChild.data.rsplit('.', 1)
414 if node.tagName == 'case':415 elif node.tagName == 'case':
415 logging.debug("Adding case %s to current test suite.", node.getAttribute("name"))416 logging.debug("Adding case %s to current test suite.",
417 node.getAttribute("name"))
416 case_runners.append(node)418 case_runners.append(node)
419 elif node.tagName == 'args':
420 self.get_args(node)
417 if None in (clsname, modname):421 if None in (clsname, modname):
418 raise Exception, "Missing a suite class"422 raise Exception, "Missing a suite class"
419423
@@ -425,7 +429,7 @@
425429
426 cls = getattr(mod, clsname)430 cls = getattr(mod, clsname)
427 431
428 self.testsuite = cls()432 self.testsuite = cls(**self.args)
429 433
430 self.case_runners = \434 self.case_runners = \
431 [TestCaseRunner(self.testsuite, c) for c in case_runners]435 [TestCaseRunner(self.testsuite, c) for c in case_runners]

Subscribers

People subscribed via source and target branches

to status/vote changes: