Validate the nose test case wrapper test member.

Apparently not every nose test case wrapper has a test member. Validate
that the member exists before accessing it. If the test case does not
have a test member check if it is a Test Suite with a _tests member.
Iterate over that iterable of tests if it exists.

Change-Id: Ie1afeb3ebc023f114975a84d8757d0c282932834
This commit is contained in:
Clark Boylan 2012-08-21 16:20:24 -07:00
parent 3f2903471b
commit 22e13ab903
1 changed files with 15 additions and 5 deletions

View File

@ -588,14 +588,24 @@ class HtmlOutput(Plugin):
rmap = {}
classes = []
for n,t,o,e in result_list:
cls = t.test.__class__
if not rmap.has_key(cls):
rmap[cls] = []
classes.append(cls)
rmap[cls].append((n,t,o,e))
if hasattr(t, '_tests'):
for inner_test in t._tests:
self._add_cls(rmap, classes, inner_test, (n,inner_test,o,e))
else:
self._add_cls(rmap, classes, t, (n,t,o,e))
r = [(cls, rmap[cls]) for cls in classes]
return r
def _add_cls(self, rmap, classes, test, data_tuple):
if hasattr(test, 'test'):
cls = test.test.__class__
else:
cls = t.__class__
if not rmap.has_key(cls):
rmap[cls] = []
classes.append(cls)
rmap[cls].append(data_tuple)
def _generate_report_test(self, rows, cid, tid, n, t, o, e):
# e.g. 'pt1.1', 'ft1.1', etc
has_output = bool(o or e)