Skip to content

Commit

Permalink
Xml formatter now groups files in testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosgoce committed Mar 18, 2015
1 parent bc79adc commit 19cb283
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions junit_conversor/__init__.py
Expand Up @@ -35,14 +35,13 @@ def _convert(origin, destination):
testsuite.attrib["tests"] = str(len(parsed))
testsuite.attrib["time"] = "1"

for line in parsed:
# todo
# Mover file, line, col, etc a testcase y quitar de testsuite
testcase = ET.SubElement(testsuite, "testcase", file=line['file'],
line=line['line'], col=line['col'])

ET.SubElement(testcase, "error", message=line['detail'],
type="flake8 %s" % line['code']).text = line['detail']
for file_name, errors in parsed.items():
testcase = ET.SubElement(testsuite, "testcase", name=file_name)

for error in errors:
ET.SubElement(testcase, "error", file=error['file'], line=error['line'], col=error['col'],
message=error['detail'], type="flake8 %s" % error['code']) \
.text = "{}:{} {}".format(error['line'], error['col'], error['detail'])

tree = ET.ElementTree(testsuite)
tree.write(destination, encoding='utf-8', xml_declaration=True)

0 comments on commit 19cb283

Please sign in to comment.