Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
conn.request( "POST", "{0}/submit.php?project={1}".format( self._location, self._project ), f )
response = conn.getresponse()
print response.status, response.reason
#TODO check result
finally:
if conn:
conn.close()
except:
#TODO: if submitting to cdash fails, try to notify the admin (mail?)
raise
if __name__ == "__main__":
r = result.Result()
r.testStarted()
r.addCheckerResult( result.CheckerResult( "test1", result.CheckerResult.Passed, "" ) )
r.addCheckerResult( result.CheckerResult( "test2", result.CheckerResult.Failed, "Something went wrong, dude!" ) )
time.sleep( 1 )
r.testFinished()
cr = CDashReporter( "http://localhost", "/CDash", "test1" )
cr.reportResult( r )
conn = httplib.HTTPConnection( self._host )
conn.request( "POST", "{0}/submit.php?project={1}".format( self._location, self._project ), f )
response = conn.getresponse()
print response.status, response.reason
#TODO check result
finally:
if conn:
conn.close()
except:
#TODO: if submitting to cdash fails, try to notify the admin (mail?)
raise
if __name__ == "__main__":
r = result.Result()
r.testStarted()
r.addCheckerResult( result.CheckerResult( "test1", result.CheckerResult.Passed, "" ) )
r.addCheckerResult( result.CheckerResult( "test2", result.CheckerResult.Failed, "Something went wrong, dude!" ) )
time.sleep( 1 )
r.testFinished()
cr = CDashReporter( "http://localhost", "/CDash", "test1" )
cr.reportResult( r )
def endElement( self, name ):
if name == 'result':
trimmed = string.strip( self._buf )
if self._status == "passed":
stat = result.CheckerResult.Passed
else:
stat = result.CheckerResult.Failed
self._res.addCheckerResult( result.CheckerResult( self._name, stat, trimmed ) )
self._inResult = False
self._buf = ""
def endElement( self, name ):
if name == 'result':
trimmed = string.strip( self._buf )
if self._status == "passed":
stat = result.CheckerResult.Passed
else:
stat = result.CheckerResult.Failed
self._res.addCheckerResult( result.CheckerResult( self._name, stat, trimmed ) )
self._inResult = False
self._buf = ""
## information to ensure the GNU General Public License requirements will
## be met: https://www.gnu.org/licenses/gpl-3.0.html.
##
## $QT_END_LICENSE$
##
#############################################################################
import datetime, socket, os, sys, traceback, time, tempfile, httplib, urllib
from xml.sax.saxutils import XMLGenerator
from xml.sax.xmlreader import AttributesNSImpl
import result, utils
from result import exitStatusAsString
from xmlutils import startElement, endElement, writeElement
checkerResultAsString = { result.CheckerResult.Passed:u"passed", result.CheckerResult.Failed:u"failed", result.CheckerResult.NotRun:u"notRun" }
def formatDate( date ):
return date.strftime( '%Y%m%d-%H%M' )
def writeExecutionResult( gen, name, r ):
if r == None or r.hasError():
stat = "failed"
else:
stat = "passed"
startElement( gen, None, "Test", { u"Status":stat } )
writeElement( gen, None, "Name", name )
writeElement( gen, None, "FullName", name )
startElement( gen, None, "NamedMeasurement", { u"type":u"text/string", u"name":u"Exit Code"} )
if r:
msg = "(Unexpected)"
def endElement( self, name ):
if name == 'result':
trimmed = string.strip( self._buf )
if self._status == "passed":
stat = result.CheckerResult.Passed
else:
stat = result.CheckerResult.Failed
self._res.addCheckerResult( result.CheckerResult( self._name, stat, trimmed ) )
self._inResult = False
self._buf = ""