Author: Ronny Pfannschmidt <[email protected]>
Branch: refine-testrunner
Changeset: r65998:27f12fe4b85e
Date: 2013-08-07 19:29 +0200
http://bitbucket.org/pypy/pypy/changeset/27f12fe4b85e/
Log: prepare junitmerge to be used as a module
diff --git a/testrunner/junitmerge.py b/testrunner/junitmerge.py
--- a/testrunner/junitmerge.py
+++ b/testrunner/junitmerge.py
@@ -2,7 +2,7 @@
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
@@ -13,6 +13,7 @@
TEST_ITEMS = 'test', 'errors', 'skips'
+
def merge(files):
accum = defaultdict(int)
children = []
@@ -36,11 +37,16 @@
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)))
-
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit