Beispiel #1
0
    def run(self): 
        """ invoke a subprocess running the test file via PyPy. 
            record its output into the 'result/user@host' subdirectory. 
            (we might want to create subdirectories for 
            each user, because we will probably all produce 
            such result runs and they will not be the same
            i am afraid. 
        """ 
        regrtest = self.parent.regrtest
        result = self.getresult(regrtest) 
        testresultdir = ensuretestresultdir()
        if testresultdir is not None:
            resultdir = testresultdir.join(result['userhost'])
            assert resultdir.ensure(dir=1)

            fn = resultdir.join(regrtest.basename).new(ext='.txt') 
            if result.istimeout(): 
                if fn.check(file=1): 
                    try: 
                        oldresult = ResultFromMime(fn)
                    except TypeError: 
                        pass
                    else: 
                        if not oldresult.istimeout(): 
                            py.test.skip("timed out, not overwriting "
                                         "more interesting non-timeout outcome")
            
            fn.write(result.repr_mimemessage().as_string(unixfrom=False))
            
        if result['exit-status']:  
             time.sleep(0.5)   # time for a Ctrl-C to reach us :-)
             print >>sys.stdout, result.getnamedtext('stdout') 
             print >>sys.stderr, result.getnamedtext('stderr') 
             py.test.fail("running test failed, see stderr output below")