src/tests/imageTestsReportNew.py
def process():
    "Process xml files generated from run, generate the csv file to be compatible with html (for now), also generate text table"
    import xml.etree.ElementTree
    table={}
    if not os.path.exists("tmp"): os.mkdir("tmp")
    fpData=open("tmp/data.csv","w")

    # Read everything into a nice dictionary
    attrs=["prepareTime","evalTime","totalTime"]
    attrsShort=["prep","eval","tot"]

    for version in versions.keys():
        xmlfile="tmp/%s.xml"%version
        e = xml.etree.ElementTree.parse(xmlfile).getroot()
        #for suite in e:
        #    for test in suite:
        #        print test
        for test in e.iter("testcase"):
            if test.get("status")=="notrun": continue
            fullname=test.get("classname")+"."+test.get("name")
            if not fullname in table:
                table[fullname]={}
            table[fullname][version]={}
            table[fullname][version]["prepareTime"]=test.get("prepareTime")
            table[fullname][version]["evalTime"]=test.get("evalTime")
            table[fullname][version]["totalTime"]=test.get("totalTime")
    #print table

    # headers
    headers=["Test Name"]
    for v in versionKeys:
        for c in attrsShort:
            headers.append("%s %s"%(v,c))
    fpData.write(",".join(headers)+"\n")
    # Build a table representation and the csv
    line="%-50s"%""
    for v in versionKeys:
        line+="|"
        line+="%18s"%v
    print(line)
    line="%-50s"%"Test Name"
    for v in versionKeys:
        line+="|"
        for c in attrsShort:
            line+=" %5s"%c
    print(line)
    print("-"*len(line))
    for entryName,entryData in table.items():
        csvLine=[entryName]
        line="%-50s"%entryName
        for v in versionKeys:
            line+="|"
            for c in attrs:
                data=None
                try:
                    data=entryData[v][c]
                except: pass
                if data:
                    if type(data)==str: data=float(data)
                    line+=" %5d"%data
                    csvLine.append(str(data))
                else:
                    line+=" -----"
                    csvLine.append("")
        fpData.write(",".join(csvLine)+"\n")
        print(line)
Process xml files generated from run, generate the csv file to be compatible with html (for now), also generate text table
Process xml files generated from run, generate the csv file to be compatible with html (for now), also generate text table
Process xml files generated from run generate the csv file to be compatible with html ( for now ) also generate text table
def process():
    import xml.etree.ElementTree
    table={}
    if not os.path.exists("tmp"): os.mkdir("tmp")
    fpData=open("tmp/data.csv","w")
    attrs=["prepareTime","evalTime","totalTime"]
    attrsShort=["prep","eval","tot"]
    for version in versions.keys():
        xmlfile="tmp/%s.xml"%version
        e = xml.etree.ElementTree.parse(xmlfile).getroot()
        for test in e.iter("testcase"):
            if test.get("status")=="notrun": continue
            fullname=test.get("classname")+"."+test.get("name")
            if not fullname in table:
                table[fullname]={}
            table[fullname][version]={}
            table[fullname][version]["prepareTime"]=test.get("prepareTime")
            table[fullname][version]["evalTime"]=test.get("evalTime")
            table[fullname][version]["totalTime"]=test.get("totalTime")
    headers=["Test Name"]
    for v in versionKeys:
        for c in attrsShort:
            headers.append("%s %s"%(v,c))
    fpData.write(",".join(headers)+"\n")
    line="%-50s"%""
    for v in versionKeys:
        line+="|"
        line+="%18s"%v
    print(line)
    line="%-50s"%"Test Name"
    for v in versionKeys:
        line+="|"
        for c in attrsShort:
            line+=" %5s"%c
    print(line)
    print("-"*len(line))
    for entryName,entryData in table.items():
        csvLine=[entryName]
        line="%-50s"%entryName
        for v in versionKeys:
            line+="|"
            for c in attrs:
                data=None
                try:
                    data=entryData[v][c]
                except: pass
                if data:
                    if type(data)==str: data=float(data)
                    line+=" %5d"%data
                    csvLine.append(str(data))
                else:
                    line+=" -----"
                    csvLine.append("")
        fpData.write(",".join(csvLine)+"\n")
        print(line)
def process ( ) : import xml . etree . ElementTree table = { } if not os . path . exists ( "tmp" ) : os . mkdir ( "tmp" ) fpData = open ( "tmp/data.csv" , "w" ) attrs = [ "prepareTime" , "evalTime" , "totalTime" ] attrsShort = [ "prep" , "eval" , "tot" ] for version in versions . keys ( ) : xmlfile = "tmp/%s.xml" % version e = xml . etree . ElementTree . parse ( xmlfile ) . getroot ( ) for test in e . iter ( "testcase" ) : if test . get ( "status" ) == "notrun" : continue fullname = test . get ( "classname" ) + "." + test . get ( "name" ) if not fullname in table : table [ fullname ] = { } table [ fullname ] [ version ] = { } table [ fullname ] [ version ] [ "prepareTime" ] = test . get ( "prepareTime" ) table [ fullname ] [ version ] [ "evalTime" ] = test . get ( "evalTime" ) table [ fullname ] [ version ] [ "totalTime" ] = test . get ( "totalTime" ) headers = [ "Test Name" ] for v in versionKeys : for c in attrsShort : headers . append ( "%s %s" % ( v , c ) ) fpData . write ( "," . join ( headers ) + "\n" ) line = "%-50s" % "" for v in versionKeys : line += "|" line += "%18s" % v print ( line ) line = "%-50s" % "Test Name" for v in versionKeys : line += "|" for c in attrsShort : line += " %5s" % c print ( line ) print ( "-" * len ( line ) ) for entryName , entryData in table . items ( ) : csvLine = [ entryName ] line = "%-50s" % entryName for v in versionKeys : line += "|" for c in attrs : data = None try : data = entryData [ v ] [ c ] except : pass if data : if type ( data ) == str : data = float ( data ) line += " %5d" % data csvLine . append ( str ( data ) ) else : line += " -----" csvLine . append ( "" ) fpData . write ( "," . join ( csvLine ) + "\n" ) print ( line )
Process xml files generated from run, generate the csv file to be compatible with html (for now), also generate text table
Process xml files generated from run generate the csv file to be compatible with html ( for now ) also generate text table
"Process xml files generated from run, generate the csv file to be compatible with html (for now), also generate text table" # Read everything into a nice dictionary #for suite in e: #    for test in suite: #        print test #print table # headers # Build a table representation and the csv