def create_test(self, test_string, scoreboard): """ test = create_test( test_string, scoreboard ) creates an appropriate derived class inheriting from gantlet.test for the given test_string """ invocation = test_invocation(test_string, self.srcdir, scoreboard) # now start checking the file system. if invocation.errmsgs: return unknown_tparser(invocation, scoreboard) if invocation.is_command: return gts_tparser_exec(invocation, scoreboard) if os.access(invocation.filename, os.R_OK): if xml_extension(invocation.extension): return xml_tparser(invocation, scoreboard) elif invocation.extension in known_extensions.keys(): return gts_tparser_script(invocation, scoreboard) if os.access(invocation.filename, os.X_OK): return gts_tparser_exec(invocation, scoreboard) elif os.access(invocation.filename, os.R_OK): return gts_tparser_read(invocation, scoreboard) else: invocation.errmsgs.append(("File not Readable", "unreadable")) return unknown_tparser(invocation, scoreboard)
def create_test( self, test_string, scoreboard ): """ test = create_test( test_string, scoreboard ) creates an appropriate derived class inheriting from gantlet.test for the given test_string """ invocation = test_invocation( test_string, self.srcdir, scoreboard ) # now start checking the file system. if invocation.errmsgs: return unknown_tparser( invocation, scoreboard ) if invocation.is_command: return gts_tparser_exec( invocation, scoreboard ) if os.access( invocation.filename, os.R_OK ): if xml_extension( invocation.extension ): return xml_tparser( invocation, scoreboard ) elif invocation.extension in known_extensions.keys(): return gts_tparser_script( invocation, scoreboard ) if os.access( invocation.filename, os.X_OK ): return gts_tparser_exec( invocation, scoreboard ) elif os.access( invocation.filename, os.R_OK ): return gts_tparser_read( invocation, scoreboard ) else: invocation.errmsgs.append( ("File not Readable","unreadable") ) return unknown_tparser( invocation, scoreboard )
def runtest(self): try: tparser = xml.sax.make_tparser() except: #create bogus test and mark it broken self.invocation.errmsgs = [ ( str(sys.exc_info()[0]), \ "missing SAX") ] t = unknown_tparser(self.invocation, self.scoreboard) self.tests.append(t) t.runtest() else: tparser.setContentHandler(self) tparser.parse(self.invocation.filename)
def runtest( self ): try: tparser = xml.sax.make_tparser() except: #create bogus test and mark it broken self.invocation.errmsgs = [ ( str(sys.exc_info()[0]), \ "missing SAX") ] t = unknown_tparser(self.invocation, self.scoreboard ) self.tests.append( t ) t.runtest() else: tparser.setContentHandler( self ) tparser.parse( self.invocation.filename )