Example #1
0
def generate_coverage(func, path, *args, **kwds):
    """
    Generates code coverage for the function
    and places the results in the path
    """
    import figleaf
    from figleaf import annotate_html

    if os.path.isdir(path):
        shutil.rmtree(path)

    # execute the function itself
    return_vals = func(*args, **kwds)

    logger.info('generating coverage')
    coverage = figleaf.get_data().gather_files()
    annotate_html.prepare_reportdir(path)

    # skip python modules and the test modules
    regpatt = lambda patt: re.compile(patt, re.IGNORECASE)
    patterns = map(regpatt, ['python', 'tests'])
    annotate_html.report_as_html(coverage,
                                 path,
                                 exclude_patterns=patterns,
                                 files_list='')

    return return_vals
Example #2
0
def generate_coverage(func, path, *args, **kwds):
    """
    Generates code coverage for the function 
    and places the results in the path
    """
    import figleaf
    from figleaf import annotate_html

    if os.path.isdir(path):
        shutil.rmtree(path)       
    
    # execute the function itself
    return_vals = func(*args, **kwds)
    
    logger.info('generating coverage')
    coverage = figleaf.get_data().gather_files()
    annotate_html.prepare_reportdir(path)
    
    # skip python modules and the test modules
    regpatt  = lambda patt: re.compile(patt, re.IGNORECASE)
    patterns = map(regpatt, [ 'python', 'tests' ])
    annotate_html.report_as_html(coverage, path, exclude_patterns=patterns,
                                 files_list='')

    return return_vals
    def get_multiblast_results(self):
        """return saved results or generate them if needed;
        results are saved so we only do this time-consuming operation once"""
        global _multiblast_results

        if not testutil.blast_enabled():
            raise SkipTest("no BLAST installed")

        if not _multiblast_results:
            logger.info("running expensive multiblast")
            blastmap = blast.BlastMapping(self.prot, verbose=False)
            al = cnestedlist.NLMSA("blasthits", "memory", pairwiseMode=True, bidirectional=False)

            blastmap(al=al, queryDB=self.prot)  # all vs all

            al.build()  # construct the alignment indexes
            results = [al[seq] for seq in self.prot.values()]
            _multiblast_results = reformat_results(results, pair_identity_tuple)

        return _multiblast_results
Example #4
0
    figleaf.start()


if options.coverage:
    start_coverage()

###

try:
    # try to import the main pygr module
    import pygr
    from pygr import logger

    # we have a logger now
    logger.info("importing pygr from %s" % pygr.__file__)

    # try to import an extension module
    from pygr import cnestedlist

except ImportError, exc:
    stop("""
    %s

    Error: '%s'

    Possible solutions:

        1. build the extension modules in place with:
                     python setup.py build_ext -i
        root.removeHandler(hand)

    figleaf.start()

if options.coverage:
    start_coverage()

###

try:
    # try to import the main pygr module
    import pygr
    from pygr import logger

    # we have a logger now
    logger.info("importing pygr from %s" % pygr.__file__)

    # try to import an extension module
    from pygr import cnestedlist

except ImportError, exc:
    stop("""
    %s

    Error: '%s'

    Possible solutions:

        1. build the extension modules in place with:
                     python setup.py build_ext -i