def test_createListDictionary(self):

        # Create a dictionary (basic values)
        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])
        #check whether entries passed in correctly.
        self.assertEqual(basicDict['arg1'], self.values[0])
        self.assertEqual(basicDict['arg2'], self.values[1])
        self.assertEqual(basicDict['arg3'], self.values[2])
        self.assertEqual(basicDict['arg4'], self.values[3])
        self.assertEqual(basicDict['directoryPath'], self.values[4])
        self.assertEqual(basicDict['docPath'], self.values[5])
        self.assertEqual(basicDict['docDataPath'], self.values[6])
        self.assertEqual(basicDict['arg5'], self.values[7])      
        # test for a few set default values and some directories. Not exhaustive.
        self.assertEqual(basicDict['metaFlag'], 'dtd')
        self.assertEqual(basicDict['extWeb'], [['http://www.underworldproject.org','Underworld Home Page']])
        self.assertEqual(basicDict['email'], '*****@*****.**')
        self.assertEqual(basicDict['doxyToggle'], 'Yes')
        self.assertEqual(basicDict['configFile'], 'Doxyfile')
        self.assertTrue(os.path.isfile( basicDict['configPath']))
        #create dictionaries to use all toggle options. and get output.
        liteDict = createDocs.createListDictionary(self.values[0], self.values[1], self.values[2],'No',self.values[4],self.values[5],self.values[6],self.values[7],self.values[8]) 
        self.assertEqual(liteDict['doxyToggle'], 'No')
        self.assertTrue(os.path.isfile( liteDict['configPath']))

        print "Tested createListDictionary"
    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_createTempFile(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])
        basicDict['tempPythonFilePath'] = os.path.realpath(self.values[5] + "/tmpfilter.py")
        #redirecting output of function so it doesn't display to stout. Needs more work.
        saveout = sys.stdout  
        fsock = open('test_createTempFile.log', 'w') 
        sys.stdout = fsock

        #run creation file
        createDocument.checkOutputPath(self.values[5])
        createDocs.createTempFile(basicDict)

        sys.stdout = saveout    
        fsock.close() 
        #should go back to stout now ...
        #test for existence. and that it runs.
        self.assertTrue(os.path.isfile(basicDict['tempPythonFilePath']))

        print "Tested createTempFile"
    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)


Ejemplo n.º 7
0
    #Define input directory (relative to ~/stgUnderworldE/ )
    if values[2] != "" :
        directoryPath = os.path.realpath(values[2])
    else:
        directoryPath = os.path.realpath('../../')
    print directoryPath
    # Create the output directory. This is relative to the ./mainProj/config page.(relative to ~/stgUnderworldE/ )
    if values[3] != "":
        docPath = os.path.realpath(values[3])
    else:
        docPath = os.path.join(directoryPath, 'doc/')
    print docPath

    # createDictionary
    mainDictionary = createListDictionary("","", "", values[1], directoryPath, docPath, values[4])

    # 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)

        
        createDoxygen(mainDictionary)



Ejemplo n.º 8
0
    

    
    #Define input directory (relative to ~/stgUnderworldE/ )
    if values[4] != "" :
        directoryPath = os.path.realpath(values[4])
    else:
        directoryPath = os.path.realpath('../../')
    print directoryPath

    # Create the output directory. This is relative to the ./mainProj/config page.(relative to ~/stgUnderworldE/ )
    if values[5] != "":
        docPath = os.path.realpath(values[5])
    else:
        docPath = os.path.join(directoryPath, 'doc/')
    print docPath

    # createDictionary
    mainDictionary = createListDictionary(values[1],values[2], values[3], "", directoryPath, docPath, values[6])

    # Set up help print statement
    if ((mainDictionary['arg1'] == "help") or (mainDictionary['arg1'] == '-h') or (mainDictionary['arg1'] =='--help') or (mainDictionary['arg1'] == 'h')):
        printHelpStatement(mainDictionary)

    else:
        #check the directory now exists.
        createDocument.checkOutputPath(docPath)

        createCodex(mainDictionary)

    # set directoryPath correctly, even if help function is invoked.
    if ((values[1] == "help") or (values[1] == '-h') or (values[1] =='--help') or (values[1] == 'h')):
        directoryPath = os.path.realpath('../../')
    elif values[1] != '':
        directoryPath = os.path.realpath(values[1])
    else:
        directoryPath = os.path.realpath('../../')

    # 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/')

    # create the main dictionary which holds the path information.
    mainDictionary = createListDictionary(directoryPath, docPath, values[3], values[4], values[5])
    #print mainDictionary.items() 

    # 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)

        #find version of the code using mercurial
        findVersion(mainDictionary)

        # call main function
        createPlugins(mainDictionary)