コード例 #1
0
ファイル: benchmark.py プロジェクト: amuralle/pygr
def run_benchmarks( fname ):
    print '%20s\t%s' % ( 'Test', 'Time') 
    
    logger.disable('DEBUG')
    
    if 1:
        cleanup()
        pygr_parse_fasta(fname )
        bio_parse_fasta(fname)
        bx_parse_fasta(fname)
        cogent_parse_fasta(fname )

    print '-' * 20

    if 1:
        pygr_iter(fname )
        bio_iter(fname)
        bx_iter(fname)
        cogent_iter(fname)

    print '-' * 20

    if 1:
        pygr_slice(fname )
        bio_slice(fname)
        bx_slice(fname)
        cogent_slice(fname)

    print '-' * 20
    
    if 1:
        pygr_reverse_comp(fname )
        bio_reverse_comp(fname)
        bx_reverse_comp(fname)
        cogent_reverse_comp(fname)
コード例 #2
0
def run_benchmarks(fname):
    print '%20s\t%s' % ('Test', 'Time')

    logger.disable('DEBUG')

    if 1:
        cleanup()
        pygr_parse_fasta(fname)
        bio_parse_fasta(fname)
        bx_parse_fasta(fname)
        cogent_parse_fasta(fname)

    print '-' * 20

    if 1:
        pygr_iter(fname)
        bio_iter(fname)
        bx_iter(fname)
        cogent_iter(fname)

    print '-' * 20

    if 1:
        pygr_slice(fname)
        bio_slice(fname)
        bx_slice(fname)
        cogent_slice(fname)

    print '-' * 20

    if 1:
        pygr_reverse_comp(fname)
        bio_reverse_comp(fname)
        bx_reverse_comp(fname)
        cogent_reverse_comp(fname)
コード例 #3
0
    def __init__(self, **kwargs):
        verbosity = kwargs.pop('verbosity', 1)
        if verbosity != 2:
            logger.disable('DEBUG')
        if kwargs.get('testRunner') is None:
            kwargs['testRunner'] = PygrTestRunner(verbosity=verbosity)

        unittest.TestProgram.__init__(self, **kwargs)
コード例 #4
0
ファイル: unittest_extensions.py プロジェクト: antonwang/pygr
    def __init__(self, **kwargs):
        verbosity = kwargs.pop('verbosity', 1)
        if verbosity < 1:
            logger.disable('INFO')  # Should implicity disable DEBUG as well
        elif verbosity < 2:
            logger.disable('DEBUG')
        if kwargs.get('testRunner') is None:
            kwargs['testRunner'] = PygrTestRunner(verbosity=verbosity)

        unittest.TestProgram.__init__(self, **kwargs)
コード例 #5
0
    def __init__(self, **kwargs):
        verbosity = kwargs.pop('verbosity', 1)
        if verbosity < 1:
            logger.disable('INFO')  # Should implicity disable DEBUG as well
        elif verbosity < 2:
            logger.disable('DEBUG')
        if kwargs.get('testRunner') is None:
            kwargs['testRunner'] = PygrTestRunner(verbosity=verbosity)

        unittest.TestProgram.__init__(self, **kwargs)
コード例 #6
0
ファイル: runtest.py プロジェクト: mamanambiya/pygr
def run(targets, options):
    "Imports and runs the modules names that are contained in the 'targets'"

    success = errors = skipped = 0

    # run the tests by importing the module and getting its test suite
    for name in targets:
        try:
            testutil.info('running tests for module %s' % name)
            l = unittest.TestLoader()
            suite = l.loadTestsFromName(name)

            runner = PygrTestRunner(verbosity=options.verbosity,
                                    descriptions=0)

            logger.disable(disable_threshold)  # set global override
            results = runner.run(suite)
            logger.disable(0)                  # clear global override

            # count tests and errors
            success += results.testsRun - \
                       len(results.errors) - \
                       len(results.failures) - \
                       len(results.skipped)

            errors += len(results.errors) + len(results.failures)
            skipped += len(results.skipped)

            # if we're in strict mode stop on errors
            if options.strict and errors:
                testutil.error("strict mode stops on errors")
                break

        except ImportError:
            testutil.error("unable to import module '%s'" % name)

    # summarize the run
    testutil.info('=' * 59)
    testutil.info('''\
%s tests passed, %s tests failed, %s tests skipped; %d total''' % \
                  (success, errors, skipped, success + errors + skipped))

    return (success, errors, skipped)
コード例 #7
0
ファイル: runtest.py プロジェクト: mamanambiya/pygr
                break

        except ImportError:
            testutil.error("unable to import module '%s'" % name)

    # summarize the run
    testutil.info('=' * 59)
    testutil.info('''\
%s tests passed, %s tests failed, %s tests skipped; %d total''' % \
                  (success, errors, skipped, success + errors + skipped))

    return (success, errors, skipped)

if __name__ == '__main__':
    # Make sure no messages are filtered out at first
    logger.disable(0)

    # gets the prebuild option parser
    parser = testoptions.option_parser()

    # parse the options
    options, args = parser.parse_args()

    # modules: from command line args or all modules
    targets = args or all_tests()

    # get rid of the .py ending in case full module names were passed in
    # the command line
    stripped_targets = []
    for t in targets:
        if t.endswith('.py'):
コード例 #8
0
ファイル: pygrdata_server.py プロジェクト: antonwang/pygr
# same options for all tests (some flags may be ignored)
parser = testoptions.option_parser()

# parse the arguments
options, args = parser.parse_args()

if options.pygrdatapath: # load from specified path
    mdb = metabase.MetabaseList(options.pygrdatapath)
else: # use default PYGRDATAPATH
    mdb = metabase.MetabaseList()
    

# disables debug messages at zero verbosity
if options.verbosity == 0:
    logger.disable('DEBUG')

# the resources are listed as colon separated names
names = filter(None, options.resources.split(':'))
resources = map(mdb, names) # load the specified resources

# set it to None by default
options.downloadDB = options.downloadDB or None

# create a new server that will serve the resources we just loaded
xmlrpc = metabase.ResourceServer(mdb, 'testy',
                                 withIndex=True,
                                 downloadDB=options.downloadDB,
                                 host='localhost', port=options.port)

# if needed, write out the port information to a file, so that the test runner
コード例 #9
0
ファイル: runtest.py プロジェクト: jamescasbon/pygr
    for t in targets:
        if t.endswith(".py"):
            t = t[:-3]
        stripped_targets.append(t)
    targets = stripped_targets

    if options.port:
        testutil.default_xmlrpc_port = options.port

    # exclusion mode
    if options.exclude:
        targets = [name for name in all_tests() if name not in targets]

    # disables debug messages at < 2 verbosity
    if options.verbosity != 2:
        logger.disable("DEBUG")

    # cleans full entire test directory
    if options.clean:
        testutil.TEMPROOT.reset()
        testutil.TEMPDIR = testutil.TEMPROOT.path  # yikes!

        # list patterns matching files to be removed here
        patterns = [
            "*.seqlen",
            "*.pureseq",
            "*.nin",
            "*.pin",
            "*.psd",
            "*.psi",
            "*.psq",