예제 #1
0
    def report(
            self,
            morfs=None,
            show_missing=True,
            ignore_errors=None,
            file=None,  # pylint: disable-msg=W0622
            omit=None,
            include=None):
        """Write a summary report to `file`.

        Each module in `morfs` is listed, with counts of statements, executed
        statements, missing statements, and a list of lines missed.

        `include` is a list of filename patterns.  Modules whose filenames
        match those patterns will be included in the report. Modules matching
        `omit` will not be included in the report.

        """
        self.config.from_args(ignore_errors=ignore_errors,
                              omit=omit,
                              include=include)
        reporter = SummaryReporter(self, show_missing,
                                   self.config.ignore_errors)
        reporter.report(morfs,
                        outfile=file,
                        omit=self.config.omit,
                        include=self.config.include)
예제 #2
0
    def report(
        self,
        morfs=None,
        show_missing=True,
        ignore_errors=None,
        file=None,  # pylint: disable=redefined-builtin
        omit=None,
        include=None,
        skip_covered=False,
    ):
        """Write a summary report to `file`.

        Each module in `morfs` is listed, with counts of statements, executed
        statements, missing statements, and a list of lines missed.

        `include` is a list of file name patterns.  Files that match will be
        included in the report. Files matching `omit` will not be included in
        the report.

        Returns a float, the total percentage covered.

        """
        self.get_data()
        self.config.from_args(
            ignore_errors=ignore_errors,
            omit=omit,
            include=include,
            show_missing=show_missing,
            skip_covered=skip_covered,
        )
        reporter = SummaryReporter(self, self.config)
        return reporter.report(morfs, outfile=file)
예제 #3
0
 def report(self,
            morfs=None,
            show_missing=True,
            ignore_errors=None,
            file=None,
            omit=None,
            include=None):
     """Write a summary report to `file`.
     
     Each module in `morfs` is listed, with counts of statements, executed
     statements, missing statements, and a list of lines missed.
     
     `include` is a list of filename patterns.  Modules whose filenames
     match those patterns will be included in the report. Modules matching
     `omit` will not be included in the report.
     
     Returns a float, the total percentage covered.
     
     """
     self._harvest_data()
     self.config.from_args(ignore_errors=ignore_errors,
                           omit=omit,
                           include=include,
                           show_missing=show_missing)
     reporter = SummaryReporter(self, self.config)
     return reporter.report(morfs, outfile=file)
예제 #4
0
    def report(
        self, morfs=None, show_missing=None, ignore_errors=None,
        file=None,                  # pylint: disable=redefined-builtin
        omit=None, include=None, skip_covered=None,
    ):
        """Write a textual summary report to `file`.

        Each module in `morfs` is listed, with counts of statements, executed
        statements, missing statements, and a list of lines missed.

        If `show_missing` is true, then details of which lines or branches are
        missing will be included in the report.  If `ignore_errors` is true,
        then a failure while reporting a single file will not stop the entire
        report.

        `file` is a file-like object, suitable for writing.

        `include` is a list of file name patterns.  Files that match will be
        included in the report. Files matching `omit` will not be included in
        the report.

        If `skip_covered` is true, don't report on files with 100% coverage.

        All of the arguments default to the settings read from the
        :ref:`configuration file <config>`.

        Returns a float, the total percentage covered.

        """
        self.config.from_args(
            ignore_errors=ignore_errors, report_omit=omit, report_include=include,
            show_missing=show_missing, skip_covered=skip_covered,
            )
        reporter = SummaryReporter(self, self.config)
        return reporter.report(morfs, outfile=file)
예제 #5
0
    def report(
        self, morfs=None, show_missing=None, ignore_errors=None,
        file=None, omit=None, include=None, skip_covered=None,
        contexts=None, skip_empty=None, precision=None, sort=None
    ):
        """Write a textual summary report to `file`.

        Each module in `morfs` is listed, with counts of statements, executed
        statements, missing statements, and a list of lines missed.

        If `show_missing` is true, then details of which lines or branches are
        missing will be included in the report.  If `ignore_errors` is true,
        then a failure while reporting a single file will not stop the entire
        report.

        `file` is a file-like object, suitable for writing.

        `include` is a list of file name patterns.  Files that match will be
        included in the report. Files matching `omit` will not be included in
        the report.

        If `skip_covered` is true, don't report on files with 100% coverage.

        If `skip_empty` is true, don't report on empty files (those that have
        no statements).

        `contexts` is a list of regular expressions.  Only data from
        :ref:`dynamic contexts <dynamic_contexts>` that match one of those
        expressions (using :func:`re.search <python:re.search>`) will be
        included in the report.

        `precision` is the number of digits to display after the decimal
        point for percentages.

        All of the arguments default to the settings read from the
        :ref:`configuration file <config>`.

        Returns a float, the total percentage covered.

        .. versionadded:: 4.0
            The `skip_covered` parameter.

        .. versionadded:: 5.0
            The `contexts` and `skip_empty` parameters.

        .. versionadded:: 5.2
            The `precision` parameter.

        """
        with override_config(
            self,
            ignore_errors=ignore_errors, report_omit=omit, report_include=include,
            show_missing=show_missing, skip_covered=skip_covered,
            report_contexts=contexts, skip_empty=skip_empty, precision=precision,
            sort=sort
        ):
            reporter = SummaryReporter(self)
            return reporter.report(morfs, outfile=file)
예제 #6
0
 def get_summary_text(self, coverage_data, options):
     """Get text output from the SummaryReporter."""
     cov = Coverage()
     cov.start()
     cov.stop()  # pragma: nested
     cov.data = coverage_data
     printer = SummaryReporter(cov, options)
     destination = StringIO()
     printer.report([], destination)
     return destination.getvalue()
예제 #7
0
파일: control.py 프로젝트: samucc/kuma
 def report(self, morfs=None, show_missing=True, ignore_errors=False,
             file=None, omit_prefixes=None):     # pylint: disable-msg=W0622
     """Write a summary report to `file`.
     
     Each module in `morfs` is listed, with counts of statements, executed
     statements, missing statements, and a list of lines missed.
     
     """
     reporter = SummaryReporter(self, show_missing, ignore_errors)
     reporter.report(morfs, outfile=file, omit_prefixes=omit_prefixes)
예제 #8
0
 def report(self,
            morfs=None,
            show_missing=True,
            ignore_errors=None,
            file=None,
            omit=None,
            include=None):
     self._harvest_data()
     self.config.from_args(ignore_errors=ignore_errors,
                           omit=omit,
                           include=include,
                           show_missing=show_missing)
     reporter = SummaryReporter(self, self.config)
     return reporter.report(morfs, outfile=file)
예제 #9
0
    def get_summary_text(self, options):
        """Get text output from the SummaryReporter."""
        self.make_rigged_file("file1.py", 339, 155)
        self.make_rigged_file("file2.py", 13, 3)
        self.make_rigged_file("file3.py", 234, 228)
        self.make_file("doit.py", "import file1, file2, file3")

        cov = Coverage(source=["."], omit=["doit.py"])
        cov.start()
        import doit  # pragma: nested # pylint: disable=import-error, unused-import
        cov.stop()  # pragma: nested
        printer = SummaryReporter(cov, options)
        destination = StringIO()
        printer.report([], destination)
        return destination.getvalue()
예제 #10
0
    def get_summary_text(self, *options):
        """Get text output from the SummaryReporter.

        The arguments are tuples: (name, value) for Coverage.set_option.
        """
        self.make_rigged_file("file1.py", 339, 155)
        self.make_rigged_file("file2.py", 13, 3)
        self.make_rigged_file("file10.py", 234, 228)
        self.make_file("doit.py", "import file1, file2, file10")

        cov = Coverage(source=["."], omit=["doit.py"])
        self.start_import_stop(cov, "doit")
        for name, value in options:
            cov.set_option(name, value)
        printer = SummaryReporter(cov)
        destination = io.StringIO()
        printer.report([], destination)
        return destination.getvalue()