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
1=== modified file 'bin/ubuntu-desktop-test'
2--- bin/ubuntu-desktop-test 2009-04-29 15:08:39 +0000
3+++ bin/ubuntu-desktop-test 2009-05-05 09:08:13 +0000
4@@ -308,6 +308,14 @@
5 class TestRunner:
6 def __init__(self):
7 self.result = {}
8+ self.args = {}
9+
10+ def get_args(self, node):
11+ for n in node.childNodes:
12+ if n.nodeType != n.ELEMENT_NODE or not n.hasChildNodes():
13+ continue
14+ self.args[n.tagName.encode('ascii')] = n.firstChild.data
15+
16 def add_results_to_node(self, node):
17 if self.result == {}: return
18 result = node.ownerDocument.createElement("result")
19@@ -344,19 +352,12 @@
20 def __init__(self, obj, xml_node):
21 TestRunner.__init__(self)
22 self.xml_node = xml_node
23- self.args = {}
24 self.name = xml_node.getAttribute('name')
25 self.test_func = getattr(
26 obj, xml_node.getElementsByTagName('method')[0].firstChild.data)
27 args_element = xml_node.getElementsByTagName('args')
28 if args_element:
29- self._get_args(args_element[0])
30-
31- def _get_args(self, node):
32- for n in node.childNodes:
33- if n.nodeType != n.ELEMENT_NODE or not n.hasChildNodes():
34- continue
35- self.args[n.tagName.encode('ascii')] = n.firstChild.data
36+ self.get_args(args_element[0])
37
38 def run(self, logger):
39 starttime = time()
40@@ -411,9 +412,12 @@
41 continue
42 if node.tagName == 'class':
43 modname, clsname = node.firstChild.data.rsplit('.', 1)
44- if node.tagName == 'case':
45- logging.debug("Adding case %s to current test suite.", node.getAttribute("name"))
46+ elif node.tagName == 'case':
47+ logging.debug("Adding case %s to current test suite.",
48+ node.getAttribute("name"))
49 case_runners.append(node)
50+ elif node.tagName == 'args':
51+ self.get_args(node)
52 if None in (clsname, modname):
53 raise Exception, "Missing a suite class"
54
55@@ -425,7 +429,7 @@
56
57 cls = getattr(mod, clsname)
58
59- self.testsuite = cls()
60+ self.testsuite = cls(**self.args)
61
62 self.case_runners = \
63 [TestCaseRunner(self.testsuite, c) for c in case_runners]

Subscribers

People subscribed via source and target branches

to status/vote changes: