From: Guido Draheim Date: Sun, 26 May 2019 11:14:21 +0000 (+0200) Subject: change testresults.xml X-Git-Tag: v0.13.72~60 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fc30f23243ef2e5ffa05ad36b684c57013fb2f88;p=zziplib change testresults.xml --- diff --git a/test/zziptests.py b/test/zziptests.py index ca48c9c..627d5ad 100644 --- a/test/zziptests.py +++ b/test/zziptests.py @@ -3516,8 +3516,8 @@ if __name__ == "__main__": help="name or path to unzip.exe to unpack *.zip [%default]") _o.add_option("-E", "--exeext", metavar="EXT", default=exeext, help="the executable extension (automake $(EXEEXT)) [%default]") - _o.add_option("--xmlresults", action="store_true", default=False, - help="print output in junit xml testresult format [%default]") + _o.add_option("--xmlresults", metavar="FILE", default=None, + help="capture results as a junit xml file [%default]") _o.add_option("-v", "--verbose", action="count", default=0, help="increase logging output [%default]") opt, args = _o.parse_args() @@ -3539,8 +3539,15 @@ if __name__ == "__main__": if arg.startswith("_"): arg = arg[1:] if matches(method, arg): suite.addTest(testclass(method)) - # TextTestRunner(verbosity=opt.verbose).run(suite) + xmlresults = None if opt.xmlresults: + if os.path.exists(opt.xmlresults): + os.remove(opt.xmlresults) + xmlresults = open(opt.xmlresults, "w") + logg.info("xml results into %s", opt.xmlresults) + # + # TextTestRunner(verbosity=opt.verbose).run(suite) + if xmlresults: import xmlrunner Runner = xmlrunner.XMLTestRunner Runner(xmlresults).run(suite)