Commits

Ronny Pfannschmidt  committed 27f12fe

prepare junitmerge to be used as a module

  • Participants
  • Parent commits 05d671b
  • Branches refine-testrunner

Comments (0)

Files changed (1)

File testrunner/junitmerge.py

 simple scrpt for junitxml file merging
 """
 
-from lxml.etree import parse, Element, tostring
+from lxml.etree import parse, Element
 from collections import defaultdict
 import argparse
 
 
 TEST_ITEMS = 'test', 'errors', 'skips'
 
+
 def merge(files):
     accum = defaultdict(int)
     children = []
 
     return new
 
+def run(paths, out):
+
+    files = map(parse, paths)
+    merged = merge(files)
+
+    with open(out, 'wb') as fp:
+        merged.getroottree().write(fp)
+
 
 if __name__ == '__main__':
     opts = parser.parse_args()
-    files = map(parse, opts.path)
+    run(opts.path, opts.out)
 
-    with open(opts.out, 'w') as fp:
-        fp.write(tostring(merge(files)))
-