summaryrefslogtreecommitdiffstats
path: root/scripts/automation/regression
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-06-20 11:50:42 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-06-20 11:50:42 +0300
commit1bc9c49fa89a3942d3d1516217635d0c6e6b0c56 (patch)
treec58b9f655295d1407cee0c91daa637296efde57c /scripts/automation/regression
parentd49f3784270f142825fa4bd4ae96730401a2b871 (diff)
regression: fix nose represenation of errors in setUpModule
Diffstat (limited to 'scripts/automation/regression')
-rwxr-xr-xscripts/automation/regression/trex_unit_test.py6
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__