How to use result - 10 common examples

To help you get started, we’ve selected a few result examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qtproject / installer-framework / tests / test-framework / vmware / control.py View on Github external
def testInstaller( self, inst, platform ):
        for vm in self._vms:
            if vm.ostype() != platform:
                continue
            for case in self._testcases:
                if not case.supportsPlatform( platform ):
                    continue
                res = result.Result()
                try:
                    try:
                        res.setInstaller( inst )
                        res.setTestCase( case )
                        res.setVirtualMachine( vm )
                        res.testStarted()
                        self.run_test( inst.path, vm, case, res )
                        res.testFinished()
                        inst.markAsTested()
                    except KeyboardInterrupt:
                        raise
                    except:
                        res.addException()
                finally:
                    self._reporter.reportResult( res )
github dbrgn / result / result / tests.py View on Github external
def test_ok_method():
    o = Ok('yay')
    n = Err('nay')
    assert o.ok() == 'yay'
    assert n.ok() is None
github dbrgn / result / result / tests.py View on Github external
def test_eq():
    assert Ok(1) == Ok(1)
    assert Err(1) == Err(1)
    assert Ok(1) != Err(1)
    assert Ok(1) != Ok(2)
    assert Err(1) != Err(2)
    assert not (Ok(1) != Ok(1))
    assert Ok(1) != "abc"
    assert Ok("0") != Ok(0)
github dbrgn / result / result / tests.py View on Github external
def test_hash():
    assert len({Ok(1), Err("2"), Ok(1), Err("2")}) == 2
    assert len({Ok(1), Ok(2)}) == 2
    assert len({Ok("a"), Err("a")}) == 2
github IDPF / epubtestweb / testsuite-site / testsuite_app / models / evaluation.py View on Github external
tests = Test.objects.filter(testsuite = testsuite)

        evaluation = self.create(
            testsuite = testsuite,
            last_updated = generate_timestamp(),
            percent_complete = 0.00,
            reading_system = reading_system
        )
        evaluation.save()
        
        total_score = Score(category = None, evaluation = evaluation)
        total_score.save()

        # create results for this evaluation
        for t in tests:
            result = Result(test = t, evaluation = evaluation, result = RESULT_NOT_ANSWERED)
            result.save()

        # update the score once results have been created
        total_score.update(evaluation.get_all_results())

        # create category score entries for this evaluation
        categories = Category.objects.filter(testsuite = evaluation.testsuite)
        for cat in categories:
            score = Score(
                category = cat,
                evaluation = evaluation
            )
            score.update(evaluation.get_category_results(cat))
            score.save()

        return evaluation
github qtproject / installer-framework / tests / test-framework / vmware / cdashreporter.py View on Github external
try:
            try:
                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 )
github qtproject / installer-framework / tests / test-framework / vmware / reporter.py View on Github external
gen.startDocument()
        gen.startPrefixMapping( 'atom', atom)
        gen.startPrefixMapping( 'tf', tf )

        startElement( gen, atom, 'entry' )
        
        writeElement( gen, atom, 'title', result.constructTitle() )
        writeElement( gen, atom, 'updated', datetime.datetime.now().isoformat() )

        writeElement( gen, tf, 'errorSummary', exitStatusAsString( result.status() ) )

        writeElement( gen, tf, 'host', socket.gethostname() )
        if result._testStart != None:
            writeElement( gen, tf, 'testStart', result._testStart.isoformat() )
        else:
            result._internalErrors.append( "Result generator: no start timestamp found." )

        if result._testEnd != None:
            writeElement( gen, tf, 'testEnd', result._testEnd.isoformat() )
        else:
            result._internalErrors.append( "Result generator: no end timestamp found." )
            
        
        startElement( gen, tf, 'installer' )
        writeElement( gen, tf, 'sourceUrl', result._installerSourceLocation )
        writeElement( gen, tf, 'platform', result._installerTargetPlatform )
        #TODO revision
        endElement( gen, tf, 'installer' )

        if result._testcase != None:
            startElement( gen, tf, 'testCase' )
            writeElement( gen, tf, 'name', result._testcase.name() )
github qtproject / installer-framework / tests / test-framework / vmware / reporter.py View on Github external
writeElement( gen, atom, 'title', result.constructTitle() )
        writeElement( gen, atom, 'updated', datetime.datetime.now().isoformat() )

        writeElement( gen, tf, 'errorSummary', exitStatusAsString( result.status() ) )

        writeElement( gen, tf, 'host', socket.gethostname() )
        if result._testStart != None:
            writeElement( gen, tf, 'testStart', result._testStart.isoformat() )
        else:
            result._internalErrors.append( "Result generator: no start timestamp found." )

        if result._testEnd != None:
            writeElement( gen, tf, 'testEnd', result._testEnd.isoformat() )
        else:
            result._internalErrors.append( "Result generator: no end timestamp found." )
            
        
        startElement( gen, tf, 'installer' )
        writeElement( gen, tf, 'sourceUrl', result._installerSourceLocation )
        writeElement( gen, tf, 'platform', result._installerTargetPlatform )
        #TODO revision
        endElement( gen, tf, 'installer' )

        if result._testcase != None:
            startElement( gen, tf, 'testCase' )
            writeElement( gen, tf, 'name', result._testcase.name() )
            writeElement( gen, tf, 'path', result._testcase.path() )
            writeElement( gen, tf, 'installScript', result._testcase.installscript() )
            endElement( gen, tf, 'testCase' )
        else:
            result._internalErrors.append( "Result generator: No test case given." )
github qtproject / installer-framework / tests / test-framework / vmware / reporter.py View on Github external
if result._testcase != None:
            startElement( gen, tf, 'testCase' )
            writeElement( gen, tf, 'name', result._testcase.name() )
            writeElement( gen, tf, 'path', result._testcase.path() )
            writeElement( gen, tf, 'installScript', result._testcase.installscript() )
            endElement( gen, tf, 'testCase' )
        else:
            result._internalErrors.append( "Result generator: No test case given." )

        if result._installationResult != None:
            startElement( gen, tf, 'installationResult' )
            writeElement( gen, tf, 'exitCode', str( result._installationResult.exitCode ) )    
            writeElement( gen, tf, 'exitStatus', exitStatusAsString( result._installationResult.exitStatus ) )    
            endElement( gen, tf, 'installationResult' )
        else:
            result._internalErrors.append( "Result generator: No installation result given." )
        startElement( gen, tf, 'checkerResult' )
        
        for err in result._checkerErrors:
            writeElement( gen, tf, 'error', err )    
        endElement( gen, tf, 'checkerResult' )
            
        startElement( gen, tf, 'virtualMachine' )
        writeElement( gen, tf, 'path', result._vm.vmxPath() )
        writeElement( gen, tf, 'platform', result._vm.ostype() )
        writeElement( gen, tf, 'snapshot', result._vm.snapshot() )
        endElement( gen, tf, 'virtualMachine' )

        startElement( gen, tf, 'internalErrors' )
        for i in result._internalErrors:
            writeElement( gen, tf, 'internalError', str( i ) )
github qtproject / installer-framework / tests / test-framework / vmware / reporter.py View on Github external
startElement( gen, tf, 'installer' )
        writeElement( gen, tf, 'sourceUrl', result._installerSourceLocation )
        writeElement( gen, tf, 'platform', result._installerTargetPlatform )
        #TODO revision
        endElement( gen, tf, 'installer' )

        if result._testcase != None:
            startElement( gen, tf, 'testCase' )
            writeElement( gen, tf, 'name', result._testcase.name() )
            writeElement( gen, tf, 'path', result._testcase.path() )
            writeElement( gen, tf, 'installScript', result._testcase.installscript() )
            endElement( gen, tf, 'testCase' )
        else:
            result._internalErrors.append( "Result generator: No test case given." )

        if result._installationResult != None:
            startElement( gen, tf, 'installationResult' )
            writeElement( gen, tf, 'exitCode', str( result._installationResult.exitCode ) )    
            writeElement( gen, tf, 'exitStatus', exitStatusAsString( result._installationResult.exitStatus ) )    
            endElement( gen, tf, 'installationResult' )
        else:
            result._internalErrors.append( "Result generator: No installation result given." )
        startElement( gen, tf, 'checkerResult' )
        
        for err in result._checkerErrors:
            writeElement( gen, tf, 'error', err )    
        endElement( gen, tf, 'checkerResult' )
            
        startElement( gen, tf, 'virtualMachine' )
        writeElement( gen, tf, 'path', result._vm.vmxPath() )