def run_basic_hook(self,posthook=None):
     relpath  = os.path.join( SerializeToXML.ref_path, "tests","")
     taboo = ["badlex.n","nonexistent_file.n","solo_return.n"]
     xml_taboo = []#["bf0.n","boolean_demorgan.n","globalvars.n","boolean_fcns.n"]
     with codecs.open( os.path.join(SerializeToXML.ref_path,"test_cases"),"r","utf-8") as fp:
         files = []
         for f in fp.readlines():
             f=f.strip()
             if len(f) > 0 and not (f in taboo):
                 files.append(f)
     files.sort()
     for file in files:
         xmlfilename = relpath+file.replace(u".n",u".xml")
         try:
             parse_tree = serializeSourceFile( srcfilename = relpath+file,tgtfile = xmlfilename )
             if posthook and not ( file in xml_taboo ):
                 posthook(parse_tree,file,xmlfilename)
             os.unlink(xmlfilename)
             self.assertTrue(True,u"Passed file #"+file)
             print("## PASSED file #",file)
         #except ParseException as e:
         #    continue
         except Exception as e:
             print("## FAILED file # ",file)
             traceback.print_exc()
 def run_basic_hook(self, posthook=None):
     relpath = os.path.join(SerializeToXML.ref_path, "tests", "")
     taboo = ["badlex.n", "nonexistent_file.n", "solo_return.n"]
     xml_taboo = [
     ]  #["bf0.n","boolean_demorgan.n","globalvars.n","boolean_fcns.n"]
     with codecs.open(os.path.join(SerializeToXML.ref_path, "test_cases"),
                      "r", "utf-8") as fp:
         files = []
         for f in fp.readlines():
             f = f.strip()
             if len(f) > 0 and not (f in taboo):
                 files.append(f)
     files.sort()
     for file in files:
         xmlfilename = relpath + file.replace(".n", ".xml")
         try:
             parse_tree = serializeSourceFile(srcfilename=relpath + file,
                                              tgtfile=xmlfilename)
             if posthook and not (file in xml_taboo):
                 posthook(parse_tree, file, xmlfilename)
             os.unlink(xmlfilename)
             self.assertTrue(True, "Passed file #" + file)
             print(("## PASSED file #", file))
         #except ParseException as e:
         #    continue
         except Exception as e:
             print(("## FAILED file # ", file))
             traceback.print_exc()
 def run_basic_hook(self,posthook=None):
     relpath  = "../../tests/"
     files = ["hello.n","ford2.n","adukku.n"]
     for file in files:
         xmlfilename = relpath+file.replace(".n",".xml")
         parse_tree = serializeSourceFile( srcfilename = relpath+file,tgtfile = xmlfilename )
         if posthook:
             posthook(parse_tree,file,xmlfilename)
         os.unlink(xmlfilename)
 def run_basic_hook(self, posthook=None):
     relpath = "../../tests/"
     files = ["hello.n", "ford2.n", "adukku.n"]
     for file in files:
         xmlfilename = relpath + file.replace(".n", ".xml")
         parse_tree = serializeSourceFile(srcfilename=relpath + file,
                                          tgtfile=xmlfilename)
         if posthook:
             posthook(parse_tree, file, xmlfilename)
         os.unlink(xmlfilename)