Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(55)  |  Call(55)  |  Derive(0)  |  Import(0)
Run unit tests based on supplied command line argument values

logname     name for logging output file, if used
getSuite    function to retrieve test suite, given selector value
args        command line arguments (or equivalent values)

        def runTests(logname, getSuite, args):
    """
    Run unit tests based on supplied command line argument values
    
    logname     name for logging output file, if used
    getSuite    function to retrieve test suite, given selector value
    args        command line arguments (or equivalent values)
    """
    sel = "unit"
    vrb = 1
    if len(args) > 1:
        sel = args[1]
    if sel == "xml":
        # Run with XML test output for use in Jenkins environment
        if not junitxml_present:
            print "junitxml module not available for XML test output"
            raise ValueError, "junitxml module not available for XML test output"
        with open('xmlresults.xml', 'w') as report:
            result = junitxml.JUnitXmlResult(report)
            result.startTestRun()
            try:
                getSuite(select="unit").run(result)
            finally:
                result.stopTestRun()
    else:
        if sel[0:3] in ["uni","com","all","int","pen"]:
            logging.basicConfig(level=logging.WARNING)
            if sel[0:3] in ["com","all"]: vrb = 2
        else:
            # Run single test with elevated logging to file via new handler
            logging.basicConfig(level=logging.DEBUG)
            # Enable debug logging to a file
            fileloghandler = logging.FileHandler(logname,"w")
            fileloghandler.setLevel(logging.DEBUG)
            # Use this formatter for shorter log records
            ###filelogformatter = logging.Formatter('%(levelname)s %(message)s', "%H:%M:%S")
            # Use this formatter to display timing information:
            filelogformatter = logging.Formatter('%(asctime)s.%(msecs)03d %(levelname)s %(message)s', "%H:%M:%S")
            fileloghandler.setFormatter(filelogformatter)
            logging.getLogger('').addHandler(fileloghandler)
            vrb = 2
        runner = unittest.TextTestRunner(verbosity=vrb)
        tests  = getSuite(select=sel)
        if tests: runner.run(tests)
    return
        


src/r/o/ro-manager-HEAD/src/roweb/test/TestRdfReport.py   ro-manager(Download)
 
if __name__ == "__main__":
    TestUtils.runTests("TestRdfReport.log", getTestSuite, sys.argv)
 
# End.

src/r/o/ro-manager-HEAD/src/rocommand/test/TestSyncCommands.py   ro-manager(Download)
 
if __name__ == "__main__":
    TestUtils.runTests("TestSyncCommands.log", getTestSuite, sys.argv)
 
# End.

src/r/o/ro-manager-HEAD/src/rocommand/test/TestSparqlQueries.py   ro-manager(Download)
 
if __name__ == "__main__":
    TestUtils.runTests("TestSparqlQueries.log", getTestSuite, sys.argv)
 
# End.

src/r/o/ro-manager-HEAD/src/rocommand/test/TestROSupport.py   ro-manager(Download)
 
if __name__ == "__main__":
    TestUtils.runTests("TestROSupport.log", getTestSuite, sys.argv)
 
# End.

src/r/o/ro-manager-HEAD/src/rocommand/test/TestROSRS_Session.py   ro-manager(Download)
 
if __name__ == "__main__":
    TestUtils.runTests("TestROSRS_Session.log", getTestSuite, sys.argv)
 
# End.

src/r/o/ro-manager-HEAD/src/rocommand/test/TestRosrsSync.py   ro-manager(Download)
 
if __name__ == "__main__":
    TestUtils.runTests("TestRosrsSync.log", getTestSuite, sys.argv)
 

src/r/o/ro-manager-HEAD/src/rocommand/test/TestROSRSMetadata.py   ro-manager(Download)
 
if __name__ == "__main__":
    TestUtils.runTests("TestROSRSMetadata.log", getTestSuite, sys.argv)
 
# End.

src/r/o/ro-manager-HEAD/src/rocommand/test/TestROMetadata.py   ro-manager(Download)
 
if __name__ == "__main__":
    TestUtils.runTests("TestROMetadata.log", getTestSuite, sys.argv)
 
# End.

src/r/o/ro-manager-HEAD/src/rocommand/test/TestROEVOSupport.py   ro-manager(Download)
 
if __name__ == "__main__":
    TestUtils.runTests("TestROSupport.log", getTestSuite, sys.argv)
 

src/r/o/ro-manager-HEAD/src/rocommand/test/TestRemoteROMetadata.py   ro-manager(Download)
 
if __name__ == "__main__":
    TestUtils.runTests("TestROMetadata.log", getTestSuite, sys.argv)
 
# End.

  1 | 2 | 3 | 4 | 5 | 6  Next