def test_createCodex(self): #This test will be longish. Have to create a full codex. # Will fail for non-UW versions. directoryPath = os.path.realpath('../../../') basicDict = createDocs.createListDictionary(self.values[0], self.values[1], self.values[2],self.values[3],directoryPath,self.values[5],self.values[6],self.values[7],self.values[8]) #redirecting output of function so it doesn't display to stout saveout = sys.stdout fsock = open('test_createCodex.log', 'w') sys.stdout = fsock #create Codex createDocument.checkOutputPath(self.values[5]) createDocs.findVersion(basicDict) createDocs.createCodex(basicDict) sys.stdout = saveout fsock.close() #should go back to stout now ... #check for existence of html files that should have been created. self.assertTrue(os.path.isfile(os.path.join(basicDict['codexSubDirPath'], 'index.html'))) self.assertTrue(os.path.isfile(os.path.join(basicDict['codexSubDirPath'], 'StGermain.html'))) self.assertTrue(os.path.isfile(os.path.join(basicDict['codexSubDirPath'], 'StgDomain.html'))) self.assertTrue(os.path.isfile(os.path.join(basicDict['codexSubDirPath'], 'StgFEM.html'))) self.assertTrue(os.path.isfile(os.path.join(basicDict['codexSubDirPath'], 'PICellerator.html'))) self.assertTrue(os.path.isfile(os.path.join(basicDict['codexSubDirPath'], 'Underworld.html'))) self.assertTrue(os.path.isfile(os.path.join(basicDict['codexSubDirPath'], 'gLucifer.html'))) print "Tested createCodex"
def test_findVersion(self): #Deliberately set directory to 1 higher than stg Dir. This should produce a 'fail' in most cases.(we want # it to 'fail' so it uses the default value. Want this test to work on all versions of UW.) directoryPath = os.path.realpath('../../../../') #This test only tests this function. Not if hg is there. basicDict = createDocs.createListDictionary(self.values[0], self.values[1], self.values[2],self.values[3],directoryPath,self.values[5],self.values[6],self.values[7],self.values[8]) #redirecting output of function so it doesn't display to stout saveout = sys.stdout fsock = open('test_findVersion.log', 'w') sys.stdout = fsock #run function createDocs.findVersion(basicDict) sys.stdout = saveout fsock.close() #should go back to stout now ... # check the version. self.assertEqual(basicDict['projectNumber'], 'Bleeding Edge') print "Tested findVersion"
def test_createDoxygen(self): #create dictionary basicDict = createDocs.createListDictionary(self.values[0], self.values[1], self.values[2],self.values[3],self.values[4],self.values[5],self.values[6],self.values[7],self.values[8]) print "Output from test test_createDoxygen. Please ignore" #print self.values print "%%%%%%%%%%%%%%%%%%%%%%%%%" #redirecting output of function so it doesn't display to stout. Needs more work. saveout = sys.stdout fsock = open('test_createDoxygen.log', 'w') sys.stdout = fsock #run createDoxygen createDocument.checkOutputPath(self.values[5]) createDocs.findVersion(basicDict) createDocs.createDoxygen(basicDict) sys.stdout = saveout fsock.close() #should go back to stout now ... print "%%%%%%%%%%%%%%%%%%%%%%%%%" #check for main index.html page in standard location. If it's there, Doxygen worked. Maybe not perfectly, # but it's there and running. self.assertTrue(os.path.isfile(os.path.join(basicDict['doxygenSubDirPath'], "html/index.html"))) print "Tested Doxygen"
#Define input directory (relative to ~/stgUnderworldE/ ) if (values[1] != "") and not( (values[1] == "help") or (values[1] == '-h') or (values[1] =='--help') or (values[1] == 'h' ) ): directoryPath = os.path.realpath(values[1]) else: directoryPath = os.path.realpath('../../') print directoryPath # Create the output directory. This is relative to the ./mainProj/config page.(relative to ~/stgUnderworldE/ ) if values[2] != "": docPath = os.path.realpath(values[2]) else: docPath = os.path.join(directoryPath, 'doc/') print docPath # createDictionary mainDictionary = createListDictionary("","", "", values[4], directoryPath, docPath, values[3], values[5], values[6]) # Set up help print statement if ((values[1] == "help") or (values[1] == '-h') or (values[1] =='--help') or (values[1] == 'h')): printHelpStatement(mainDictionary) else: #check the directory now exists. createDocument.checkOutputPath(docPath) findVersion(mainDictionary) createDoxygen(mainDictionary)