nose-cov /

"""Coverage plugin for nose."""

import logging

from nose.plugins.base import Plugin

log = logging.getLogger(__name__)

class Cov(Plugin):
    """Activate cov plugin to generate coverage reports"""

    score = 200
    status = {}

    def options(self, parser, env):
        """Add options to control coverage."""

        log.debug('nose-cov options')

        Plugin.options(self, parser, env)
        parser.add_option('--cov', action='append', default=env.get('NOSE_COV', []), metavar='PATH',
                          help=('Measure coverage for filesystem path '
        parser.add_option('--cov-report', action='append', default=env.get('NOSE_COV_REPORT', []), metavar='TYPE',
                          choices=['term', 'term-missing', 'annotate', 'html', 'xml'],
                          help=('Generate selected reports, available types: term, term-missing, annotate, html, xml '
        parser.add_option('--cov-config', action='store', default=env.get('NOSE_COV_CONFIG', '.coveragerc'), metavar='FILE',
                          help=('Config file for coverage, default: .coveragerc '

    def configure(self, options, config):
        """Activate coverage plugin if appropriate."""

        log.debug('nose-cov configure')

        except KeyError:

        Plugin.configure(self, options, config)

        if self.enabled and not config.worker:
            self.status['active'] = True
            self.cov_source = options.cov_source or ['.']
            self.cov_report = options.cov_report or ['term']
            self.cov_config = options.cov_config
            self.enabled = False

    def begin(self):
        """Erase any previous coverage data and start coverage."""

        import cov_core

        log.debug('nose-cov begin')
        self.cov_controller = cov_core.Central(self.cov_source, self.cov_report, self.cov_config)

    def report(self, stream):
        """Produce coverage reports."""

        log.debug('nose-cov report')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.