diff options
-rwxr-xr-x | scripts/automation/regression/trex_unit_test.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/automation/regression/trex_unit_test.py b/scripts/automation/regression/trex_unit_test.py index 606556d3..5eb9e222 100755 --- a/scripts/automation/regression/trex_unit_test.py +++ b/scripts/automation/regression/trex_unit_test.py @@ -50,7 +50,11 @@ from distutils.dir_util import mkpath # override nose's strange representation of setUpClass errors def __suite_repr__(self): - return "%s.%s" % (nose.suite._strclass(self.context), getattr(self.context, '__name__', self.context)) + if hasattr(self.context, '__module__'): # inside class, setUpClass etc. + class_repr = nose.suite._strclass(self.context) + else: # outside of class, setUpModule etc. + class_repr = nose.suite._strclass(self.__class__) + return '%s.%s' % (class_repr, getattr(self.context, '__name__', self.context)) nose.suite.ContextSuite.__repr__ = __suite_repr__ nose.suite.ContextSuite.__str__ = __suite_repr__ |