From 22e13ab90326533c74d7c819709177f45ea46727 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 21 Aug 2012 16:20:24 -0700 Subject: [PATCH] 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 --- htmloutput/htmloutput.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htmloutput/htmloutput.py b/htmloutput/htmloutput.py index 698e1b8..70bb2f5 100644 --- a/htmloutput/htmloutput.py +++ b/htmloutput/htmloutput.py @@ -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)