- Improve error message as to why parsing the Cobertura report failed.
- Fix total stmts, miss and cover values in the coverage report when an ignore regex is passed. Thanks @danctorres
- Feat: Support executing pycobertura as a python module with:
python -m pycobertura
. Thanks @paveltsialnou
- Fix:
Cobertura.branch_rate()
returnsNone
whenbranch-rate
is absent from the Cobertura coverage report instead of raisingTypeError
. Thanks @starcruiseromega
- Fix: Account for moved/renamed/delted files in miss counts. Thanks @wdouglass
- Fix
IndexError: list index out of range
error raised bypycobertura diff
when number of files with coverage change is less then total number of files in coverage report. Thanks @ulasozguler
- Make
ZipFileSystem
read files in text mode to fix diffing mixed file systems. Thanks @ernestask - Add Python 3.11 as a supported version. Thanks @ernestask
pycobertura diff
now supports output format:github-annotation
. Thanks @goatwu1993
pycobertura show
now supports output format:github-annotation
. Thanks @goatwu1993
-
BACKWARD INCOMPATIBLE:
- Deprecate Python3.5 and 3.6, support Python 3.7 onwards (see
python_requires, classifiers in
setup.cfg
) - Update tests to Python 3.7 through 3.9 (affects
tox.ini
and.travis.yml
) - Migrate to
setup.cfg
andpyproject.toml
; emptysetup.py
kept for compatibility reasons - Update
release.sh
script - Address markdown lint in
README.md
- Do not use
object
in class inheritance as this is default behaviour in Python3 - Move formatting in
reporters.py
intoReporter
andDeltaReporter
base classes to have a uniform formatting: newstringify
inutils.py
method and corresponding test intest_stringify.py
. The subclasses and only inherit from these two base classes to ensure a consistent formatting across the reporters - Change datastructure of coverage information from
namedtuple
(immutable) todictionary
(mutable) inreporters.py
. Adjustedhtml-delta.jinja2
,html.jinja2
andfilters.py
accordingly. This change in datastructure leads to a more compact and more readable code - Only uncovered lines are reported in
Missing
column (instead of additionally reporting newly covered lines) - Coverage diff for new files now make the assumption that "previous files" were covered at 100% and will no longer show an empty value represented by a dash "-".
Thanks @gro1m
- Deprecate Python3.5 and 3.6, support Python 3.7 onwards (see
python_requires, classifiers in
-
Fix handling of multiple classes in same file - thanks to @smortvedt, @gro1m
-
Replace Travis-ci with Github Actions. We were having issues with Travis pipeline not triggering because of quota issues.
-
Changes in Cobertura class. All
"./packages//class"
elements extracted at once now, and this leads to significant speedup. Thanks @oev81 -
Changes in setup.cfg related to package data. Remove
include_package_data=True
, because it requiresMANIFEST.in
and add[options.package_data]
instead. This change makes the package installing from archive not miss*.css
and*.jinja2
files. Thanks @oev81 -
Add option
--ignore-regex
to ignore some files using either a Python regex pattern or a path to a.gitignore
file. Thanks @gro1m -
pycobertura show
andpycobertura diff
now support output formats:json
,markdown
,csv
, andyaml
. Thanks @gro1m
- Added the option
show_missing
toHtmlReporterDelta
, which specifies whether or not the "Missing" column is displayed in the generated summary table. Thanks @loganharbour
- Drop the
colorama
dependency in favor of hardcoded ANSI escape codes. Thanks @luislew
- BACKWARD INCOMPATIBLE: The class
Cobertura
no longer instantiates a defaultFileSystem
object if none is provided in the constructorCobertura.__init__(filesystem=...)
. If the content of files is accessed (e.g. to render a full coverage report) then aFileSystem
instance must be provided. - The class
Cobertura
will raiseMissingFileSystem
if noFileSystem
object was provided via the keyword argumentCobertura(filesystem=...)
. It will only be raised when calling methods that attempt to read the content of files, e.g.Cobertura.file_source(...)
orCobertura.source_lines(...)
.
- Support loading Cobertura reports from an XML string. Thanks @williamfzc
- Fix (or add?!) support for providing file objects to
Cobertura
.
- Fix misreported coverage when a single coverage file is used with
pycobertura diff
to overlay covered and uncovered changes between two different sources. Thanks @bastih
- Let the caller customize the appearance of the HTML report providing a
title
, omitting the rendering of sources by means of the booleanrender_file_sources
and providing an helpful message to the end-users (in place of the sources) by means of theno_file_sources_message
parameter. Contributed by @nilleb. - Add a
GitFilesystem
to allow pycobertura to access source files at different revisions from a git repository. Thanks @nilleb. - BACKWARDS INCOMPATIBLE: Change the signature of the Cobertura object in order to accept a filesystem.
- BACKWARDS INCOMPATIBLE: Drop support for Python 2.
- Added tox task
black
, to use the the uncompromising Python code formatter. See https://black.readthedocs.io/en/stable/ to learn more about black. Thanks @nilleb.
- Use a different
memoize()
implementation so that cached objects can be freed/garbage collected and prevent from running out of memory when processing a lot of cobertura files. Thanks @kannaiah
- Calculate the correct line rate for diffs (#83). Previously
CoberturaDiff.diff_line_rate
with no filename argument would total up the different line rate changes from all of the modified files, which is not the correct difference in line rates between all files. Now the difference in line rate from the two reports objects will be directly used if no argument is passed. (@borgstrom)
- Update author/repository info
- Update release script to use twine
- Avoid duplicate file names in files() (#82). Some coverage reports include metrics for multiple classes within the same file and redundant rows would be generated for such reports. Thanks James DeFelice! (@jdef)
- Drop support for Python 2.6
- Fix a
IndexError: list index out of range
error by being less specific about where to findclass
elements in the Cobertura report.
- BACKWARDS INCOMPATIBLE: when a source file is not found in disk pycobertura
will now raise a
pycobertura.filesystem.FileSystem.FileNotFound
exception instead of anIOError
. - possibility to pass a zip archive containing the source code instead of a directory
- BACKWARDS INCOMPATIBLE: Rename keyword argument
Cobertura(base_path=None)
>Cobertura(source=None)
- Introduce new keyword argument
Cobertura(source_prefix=None)
- Fix an
IOError
/FileNotFound
error which happens when the same coverage report is provided twice topycobertura diff
(diff in degraded mode) but the first code base (--source1
) is missing a file mentioned in the coverage report. - Fix a rare bug when diffing coverage xml where one file goes from zero lines to non-zero lines.
-
The coverage report now displays the class's filename instead of the class's name, the latter being more subject to different interpretations by coverage tools. This change was done to support coverage.py versions 3.x and 4.x.
-
BACKWARDS INCOMPATIBLE: removed
CoberturaDiff.filename()
-
BACKWARDS INCOMPATIBLE: removed the term "class" from the API which make it more difficult to reason about. Now preferring "filename":
Cobertura.line_rate(class_name=None)
>Cobertura.line_rate(filename=None)
Cobertura.branch_rate(class_name=None)
>Cobertura.branch_rate(filename=None)
Cobertura.missed_statements(class_name)
>Cobertura.missed_statements(filename)
Cobertura.hit_statements(class_name)
>Cobertura.hit_statements(filename)
Cobertura.line_statuses(class_name)
>Cobertura.line_statuses(filename)
Cobertura.missed_lines(class_name)
>Cobertura.missed_lines(filename)
Cobertura.class_source(class_name)
>Cobertura.file_source(filename)
Cobertura.total_misses(class_name=None)
>Cobertura.total_misses(filename=None)
Cobertura.total_hits(class_name=None)
>Cobertura.total_hits(filename=None)
Cobertura.total_statements(class_name=None)
>Cobertura.total_statements(filename=None)
Cobertura.filepath(class_name)
>Cobertura.filepath(filename)
Cobertura.classes()
>Cobertura.files()
Cobertura.has_classfile(class_name)
>Cobertura.has_file(filename)
Cobertura.class_lines(class_name)
>Cobertura.source_lines(filename)
CoberturaDiff.diff_total_statements(class_name=None)
>CoberturaDiff.diff_total_statements(filename=None)
CoberturaDiff.diff_total_misses(class_name=None)
>CoberturaDiff.diff_total_misses(filename=None)
CoberturaDiff.diff_total_hits(class_name=None)
>CoberturaDiff.diff_total_hits(filename=None)
CoberturaDiff.diff_line_rate(class_name=None)
>CoberturaDiff.diff_line_rate(filename=None)
CoberturaDiff.diff_missed_lines(class_name)
>CoberturaDiff.diff_missed_lines(filename)
CoberturaDiff.classes()
>CoberturaDiff.files()
CoberturaDiff.class_source(class_name)
>CoberturaDiff.file_source(filename)
CoberturaDiff.class_source_hunks(class_name)
>CoberturaDiff.file_source_hunks(filename)
Reporter.get_source(class_name)
>Reporter.get_source(filename)
HtmlReporter.get_class_row(class_name)
>HtmlReporter.get_class_row(filename)
DeltaReporter.get_source_hunks(class_name)
>DeltaReporter.get_source_hunks(filename)
DeltaReporter.get_class_row(class_name)
>DeltaReporter.get_file_row(filename)
- BACKWARDS INCOMPATIBLE: return different exit codes depending on
diff
status. Thanks Marc Abramowitz.
- a non-zero exit code will be returned if not all changes have been covered. If
--no-source
is provided then it will only check if coverage has worsened, which is less strict.
- memoize expensive methods of
Cobertura
(lxml/disk) - assume source code is UTF-8
- prevent misalignment of source code and line numbers, this would happen when the source is too long causing it to wrap around.
- pycobertura diff now renders colors in terminal with Python 2.x (worked for Python 3.x). For this to work we need to require Click 4.0 so that the color auto-detection of Click can be overridden (not possible in Click 3.0)
- Introduce
Line
namedtuple object which represents a line of source code and coverage status. - BACKWARDS INCOMPATIBLE: List of tuples generated or handled by various
function now return
Line
objects (namedtuple) for each line. - add plus sign (+) in front of lines that were added/modified on HTML diff report
- upgrade to Skeleton 2.0.4 (88f03612b05f093e3f235ced77cf89d3a8fcf846)
- add legend to HTML diff report
- expose
CoberturaDiff
under the pycobertura namespace - pycobertura diff no longer reports unchanged classes
- fix incorrect "TOTAL" row counts of the diff command when classes were added or removed from the second report.
- Options of pycobertura diff
--missed
and--no-missed
have been renamed to--source
and--no-source
which will not show the source code nor display missing lines since they cannot be accurately computed without the source. - Optimized xpath syntax for faster class name lookup (~3x)
- Colorize total missed statements
pycobertura diff
exit code will be non-zero until all changes are covered
pycobertura diff
HTML output now only includes hunks of lines that have coverage changes and skips unchanged classes- handle asymmetric presence of classes in the reports (regression introduced in 0.4.0)
- introduce
CoberturaDiff.diff_missed_lines()
- introduce
CoberturaDiff.classes()
- introduce
CoberturaDiff.filename()
- introduce
Cobertura.filepath()
which will return the system path to the file. It usesbase_path
to resolve the path. - the summary table of
pycobertura diff
no longer shows classes that are no longer present Cobertura.filename()
now only returns the filename of the class as found in the Cobertura report, anybase_path
computation is omitted.- Argument
xml_source
ofCobertura.__init__()
is renamed toxml_path
and only accepts an XML path because much of the logic involved in source code path resolution is based on the path provided which cannot work with file objects or XML strings. - Rename
Cobertura.source
->Cobertura.xml_path
pycobertura diff
now takes options--missed
(default) or--no-missed
to show missed line numbers. If--missed
is given, the paths to the source code must be accessible.
- return non-zero exit code if uncovered lines rises (previously based on line rate)
- rename
Cobertura.total_lines()
->Cobertura.total_statements()
- rename
Cobertura.line_hits()
->Cobertura.hit_statements()
- introduce
Cobertura.missed_statements()
- introduce
Cobertura.line_statuses()
which returns line numbers for a given class name with hit/miss statuses - introduce
Cobertura.class_source()
which returns the source code for a given class along with hit/miss status pycobertura show
now includes HTML sourcepycobertura show
now accepts--source
which indicates where the source code directory is locatedCobertura()
now takes an optionalbase_path
argument which will be used to resolve the path to the source code by joining thebase_path
value to the path found in the Cobertura report.- an error is now raised if
Cobertura
is passed a non-existent XML file path pycobertura diff
now includes HTML sourcepycobertura diff
now accepts--source1
and--source2
which indicates where the source code directory of each of the Cobertura reports are located- introduce
CoberturaDiff
used to diffCobertura
objects - argument
class_name
forCobertura.total_statements
is now optional - argument
class_name
forCobertura.total_misses
is now optional - argument
class_name
forCobertura.total_hits
is now optional
- update description of pycobertura
- pep8-ify
- add pep8 tasks for tox and travis
- diff command returns non-zero exit code if coverage worsened
Cobertura.branch_rate
is now a method that can take an optionalclass_name
argument- refactor internals for improved readability
- show classes that contain no lines, e.g.
__init__.py
- add
Cobertura.filename(class_name)
to retrieve the filename of a class - fix erroneous reporting of missing lines which was equal to the number of missed statements (wrong because of multiline statements)
- fix py26 compatibility by switching the XML parser to
lxml
which has a more predictible behavior when used across all Python versions. - add Travis CI
- apply Skeleton 2.0 theme to html output
- add
-o
/--output
option to write reports to a file. - known issue: diffing 2 files with options
--format text
,--color
and--output
does not render color under PY2.
- add
--color
and--no-color
options topycobertura diff
. - add option
-f
and--format
with output oftext
(default) andhtml
. - change class naming from
report
toreporter
- MIT license
- use pypandoc to convert the
long_description
in setup.py from Markdown to reStructuredText so pypi can digest and format the pycobertura page properly.
- Initial version