diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py index abb50fc7..3d429012 100755 --- a/tests/test_pretty_print.py +++ b/tests/test_pretty_print.py @@ -299,22 +299,59 @@ TESTLOG return imgs, txtpages -def wikitohtml(wiki_rootpath, sysid, wikidata, manifest): - # temporarily defunct/broken +def tohtml(wiki_rootpath, startdate, tests, enddate, sysinfo, sysid, makefiles): + # kludge. assume wiki stuff has alreayd run and dumped files properly head = ''+wiki_rootpath+' test run for '+sysid +'' - revmanifest = dict((val,key) for key, val in manifest.iteritems()) - x=re.sub('\{\|(.*?)\n','\n',wikidata) - x=re.sub('\|(.*?colspan.*?)\|','
',x) - x=re.sub("'''(.*?)'''","\\1",x) - filestrs=re.findall('\[\[File\:(.*?)\|.*?\]\]',x) - for f in filestrs: - newfile_html='' - x=re.sub('\[\[File\:'+f+'\|.*?\]\]',newfile_html,x) - dic = { '|}':'
', '|-':'', '||':'', '|':'', - '!!':'', '!':'', '\n\n':'\n

\n'} #order matters - for key in dic: x=x.replace(key,dic[key]) - x=re.sub("\[\[(.*?)\]\]","\\1",x) - return head + x + '' + tail = '' + + passed_tests = filter(lambda x: x.passed, tests) + failed_tests = filter(lambda x: not x.passed, tests) + percent = str(int(100.0*len(passed_tests) / len(tests))) + + s='' + + s+= '\n

'
+	s+= '\nSYSINFO\n'+ sysinfo
+	s+= '\n

' + + s+= '\n

'
+	s+= '\nSTARTDATE: '+ startdate
+	s+= '\nENDDATE: '+ enddate
+	s+= '\nWIKI_ROOTPATH: '+ wiki_rootpath
+	s+= '\nSYSID: '+sysid
+	s+= '\nNUMTESTS: '+str(len(tests))
+	s+= '\nNUMPASSED: '+str(len(passed_tests))
+	s+= '\nPERCENTPASSED: '+ percent
+	s+= '\n
' + + for t in tests: + if t.type=='txt': + s+='\n
'+t.fullname+'
\n' + s+='

'+t.fulltestlog+'
\n\n' + elif t.type=='png': + tmp = t.actualfile.replace(builddir,'') + wikiname_a = wikify_filename(tmp,wiki_rootpath,sysid) + tmp = t.expectedfile.replace(os.path.dirname(builddir),'') + wikiname_e = wikify_filename(tmp,wiki_rootpath,sysid) + s+='' + s+='\n
'+t.fullname + s+='\n
ExpectedActual' + s+='\n
' + s+='\n ' + s+='\n
' + s+='\n
'
+			s+=t.fulltestlog
+			s+='\n
' + + s+='\n\n

\n\n' + makefiles_wikinames = {} + for mf in sorted(makefiles.keys()): + tmp = mf.replace('CMakeFiles','').replace('.dir','') + wikiname = wikify_filename(tmp,wiki_rootpath,sysid) + s += '\n'+wikiname+'
' + s+='\n' + + return head + s + tail def wiki_login(wikiurl,api_php_path,botname,botpass): site = mwclient.Site(wikiurl,api_php_path) @@ -418,8 +455,11 @@ def main(): if verbose: print 'erasing files in',wikidir map(lambda x:os.remove(os.path.join(wikidir,x)), os.listdir(wikidir)) print 'writing',len(imgs),'images and',len(txtpages),'text pages to:\n', ' .'+wikidir.replace(os.getcwd(),'') - for k in sorted(imgs): trysave( os.path.join(wikidir,k), imgs[k]) - for k in sorted(txtpages): trysave( os.path.join(wikidir,k), txtpages[k]) + for pgname in sorted(imgs): trysave( os.path.join(wikidir,pgname), imgs[pgname]) + for pgname in sorted(txtpages): trysave( os.path.join(wikidir,pgname), txtpages[pgname]) + + htmldata = tohtml(wiki_rootpath, startdate, tests, enddate, sysinfo, sysid, makefiles) + trysave( os.path.join(wikidir,'index.html'), htmldata ) if '--upload' in sys.argv: upload(wikisite,wiki_api_path,wiki_rootpath,sysid,'openscadbot',