validate:tools: Do not duplicated name in the classname in xunit reports

This commit is contained in:
Thibault Saunier 2014-01-10 16:46:00 +01:00
parent 654bacebc9
commit 26e3a9e3c5
3 changed files with 15 additions and 5 deletions

View file

@ -138,7 +138,8 @@ class GstValidateManager(TestsManager, Loggable):
if config.getboolean("media-info", "is-image") is True: if config.getboolean("media-info", "is-image") is True:
continue continue
for comb in COMBINATIONS: for comb in COMBINATIONS:
classname = "validate.transcode.to_%s" % (str(comb).replace(' ', '_')) classname = "validate.transcode.to_%s.%s" % (str(comb).replace(' ', '_'),
os.path.splitext(os.path.basename(uri))[0].replace(".", "_"))
self.tests.append(GstValidateTranscodingTest(classname, self.tests.append(GstValidateTranscodingTest(classname,
self.options, self.options,
self.reporter, self.reporter,

View file

@ -63,6 +63,15 @@ class Test(Loggable):
return string return string
def get_classname(self):
name = self.classname.split('.')[-1]
classname = self.classname.replace('.%s' % name, '')
return classname
def get_name(self):
return self.classname.split('.')[-1]
def add_arguments(self, *args): def add_arguments(self, *args):
for arg in args: for arg in args:
self.command += " " + arg self.command += " " + arg

View file

@ -176,8 +176,8 @@ class XunitReporter(Reporter):
'<testcase classname=%(cls)s name=%(name)s time="%(taken).3f">' '<testcase classname=%(cls)s name=%(name)s time="%(taken).3f">'
'<failure type=%(errtype)s message=%(message)s>' '<failure type=%(errtype)s message=%(message)s>'
'</failure>%(systemout)s</testcase>' % '</failure>%(systemout)s</testcase>' %
{'cls': self._quoteattr(test.classname), {'cls': self._quoteattr(test.get_classname()),
'name': self._quoteattr(test.classname.split('.')[-1]), 'name': self._quoteattr(test.get_name()),
'taken': test.time_taken, 'taken': test.time_taken,
'errtype': self._quoteattr(test.result), 'errtype': self._quoteattr(test.result),
'message': self._quoteattr(test.message), 'message': self._quoteattr(test.message),
@ -191,8 +191,8 @@ class XunitReporter(Reporter):
self.errorlist.append( self.errorlist.append(
'<testcase classname=%(cls)s name=%(name)s ' '<testcase classname=%(cls)s name=%(name)s '
'time="%(taken).3f">%(systemout)s</testcase>' % 'time="%(taken).3f">%(systemout)s</testcase>' %
{'cls': self._quoteattr(test.classname), {'cls': self._quoteattr(test.get_classname()),
'name': self._quoteattr(test.classname.split('.')[-1]), 'name': self._quoteattr(test.get_name()),
'taken': test.time_taken, 'taken': test.time_taken,
'systemout': self._get_captured(), 'systemout': self._get_captured(),
}) })