MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / writeOutput

Function writeOutput

tools/PythonExtensionChecker.py:988–1035  ·  view source on GitHub ↗
(testresults, output_format, cnt, bin_path)

Source from the content-addressed store, hash-verified

986 """
987
988def writeOutput(testresults, output_format, cnt, bin_path):
989 ###################################
990 # Output
991 ###################################
992 if output_format in ["text", "text-verbose", "text-quiet"]:
993 for classtestresults in testresults:
994 if len(classtestresults) > 1:
995 t = classtestresults[0]
996 lenfailed = len([t for t in classtestresults if not t.isPassed() ] )
997 if lenfailed > 0:
998 print ("== Test results for element %s - from Cpp file %s with maintainer %s and corresponding pxd file %s" % (
999 t.comp_name, t.file_location, t.maintainer, t.pxdfile))
1000
1001 for tres in classtestresults:
1002 if not tres.isPassed():
1003 print (tres.message)
1004 elif tres.log_level >= 10 and output_format in ["text", "text-verbose"]:
1005 print (tres.message)
1006 elif tres.log_level >= 0 and output_format in ["text-verbose"]:
1007 print (tres.name, "::", tres.message)
1008
1009 elif output_format == "xml":
1010
1011 # check if all files required to report in CDash are present
1012 tag_file = os.path.join(bin_path, "Testing", "TAG" )
1013 try:
1014 # read the first line of tagfile (TAG) -> if it does not exist,
1015 # an IOError is thrown
1016 with open(tag_file) as f:
1017 ctestReportingPath = f.readline().strip()
1018 ctestReportingPath = os.path.join(bin_path, "Testing", ctestReportingPath)
1019 if not os.path.exists( ctestReportingPath ):
1020 raise Exception("Missing directory at %s" % ( ctestReportingPath ) )
1021 except IOError:
1022 raise Exception("Missing nightly test information at %s" % (tag_file) )
1023
1024 template_path = os.path.join(ctestReportingPath, "Test.xml" )
1025 output_path = template_path # output is always Test.xml
1026 if not os.path.isfile(template_path):
1027 template_path = os.path.join(ctestReportingPath, "Build.xml" ) #Build.xml an be used as alternative template
1028
1029 testresults.to_cdash_xml(template_path, output_path)
1030
1031 else:
1032 raise Exception("Unknown output format %s" % output_format)
1033
1034 cnt.print_stats()
1035 cnt.print_skipping_reason()
1036
1037
1038def checkPythonPxdHeader(src_path, bin_path, ignorefilename, pxds_out, print_pxd, output_format, generate_pxd, verbose):

Callers 1

checkPythonPxdHeaderFunction · 0.85

Calls 6

ExceptionClass · 0.85
isPassedMethod · 0.80
to_cdash_xmlMethod · 0.80
print_statsMethod · 0.80
print_skipping_reasonMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected