Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nedbat/coveragepy
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7.5.1
Choose a base ref
...
head repository: nedbat/coveragepy
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7.5.2
Choose a head ref

Commits on May 4, 2024

  1. build: bump version

    nedbat committed May 4, 2024
    Copy the full SHA
    92c2490 View commit details

Commits on May 5, 2024

  1. debug: keep COVERAGE_DIS=1 working well on 3.13

    It's helpful to see byte offsets.  I'm learning that dis is not considered
    something that needs backward compatibility...
    nedbat committed May 5, 2024
    Copy the full SHA
    c69e5db View commit details
  2. docs: typo in a lab file

    nedbat committed May 5, 2024
    Copy the full SHA
    695b8bc View commit details
  3. feat: remember the values for 'filter' and 'hide 100% covered' in HTM…

    …L report. (#1776)
    devdanzin authored May 5, 2024
    Copy the full SHA
    94e3388 View commit details
  4. docs: changelog for saving HTML settings.

    The work is in the previous commit, 94e3388.
    nedbat committed May 5, 2024
    Copy the full SHA
    0bab905 View commit details
  5. Copy the full SHA
    ccde34d View commit details
  6. test(build): update saved js support file

    nedbat committed May 5, 2024
    Copy the full SHA
    a11e0e2 View commit details

Commits on May 8, 2024

  1. docs: use sphinx-lint

    nedbat committed May 8, 2024
    Copy the full SHA
    0a6e692 View commit details

Commits on May 9, 2024

  1. docs: 3.13.0b1 is supported

    nedbat committed May 9, 2024
    Copy the full SHA
    dfcd804 View commit details

Commits on May 11, 2024

  1. test(fix): use os.device_encoding(0) to figure out stdin encoding in …

    …run_command() (Fix #1777) (#1780)
    
    * Use os.device_encoding(0) to figure out stdin encoding in run_command().
    
    * Use the encoding of stdout (fd 1) to decode the output of subprocess.Popen.
    
    Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
    
    * refactor to remove a helper used in only one place
    
    ---------
    
    Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
    devdanzin and nedbat authored May 11, 2024
    Copy the full SHA
    2040bce View commit details

Commits on May 12, 2024

  1. build: python3.14 nightly

    nedbat committed May 12, 2024
    Copy the full SHA
    e05f60c View commit details

Commits on May 13, 2024

  1. Copy the full SHA
    5c70761 View commit details

Commits on May 14, 2024

  1. Copy the full SHA
    75f9d51 View commit details

Commits on May 15, 2024

  1. Copy the full SHA
    96bd930 View commit details
  2. Copy the full SHA
    81089de View commit details

Commits on May 20, 2024

  1. fix: catch TokenError on parse (#1788)

    * catch TokenError on parse
    
    * typo, use env.PYVERSION
    
    * Update tests/test_parser.py
    
    ---------
    
    Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
    tybug and nedbat authored May 20, 2024
    Copy the full SHA
    364282e View commit details
  2. Copy the full SHA
    0700018 View commit details
  3. Copy the full SHA
    60a5d65 View commit details

Commits on May 21, 2024

  1. build: pylint can run in parallel

    But for some reason finds three new violations when you do?
    nedbat committed May 21, 2024
    Copy the full SHA
    535ddc3 View commit details

Commits on May 24, 2024

  1. docs: prep for 7.5.2

    nedbat committed May 24, 2024
    Copy the full SHA
    946fa3a View commit details
  2. docs: sample HTML for 7.5.2

    nedbat committed May 24, 2024
    Copy the full SHA
    7f33622 View commit details

Commits on May 26, 2024

  1. Copy the full SHA
    242adea View commit details
Showing with 358 additions and 232 deletions.
  1. +1 −0 .github/workflows/python-nightly.yml
  2. +30 −0 CHANGES.rst
  3. +1 −0 CONTRIBUTORS.txt
  4. +1 −1 README.rst
  5. +1 −1 coverage/html.py
  6. +16 −0 coverage/htmlfiles/coverage_html.js
  7. +5 −5 coverage/htmlfiles/index.html
  8. +1 −14 coverage/misc.py
  9. +49 −61 coverage/parser.py
  10. +4 −2 coverage/python.py
  11. +3 −3 coverage/pytracer.py
  12. +1 −1 coverage/version.py
  13. +13 −0 doc/branch.rst
  14. +4 −4 doc/changes.rst
  15. +3 −3 doc/conf.py
  16. +1 −1 doc/index.rst
  17. +1 −0 doc/requirements.in
  18. +9 −3 doc/requirements.pip
  19. +5 −5 doc/sample_html/class_index.html
  20. +16 −0 doc/sample_html/{coverage_html_cb_da166b87.js → coverage_html_cb_6fb7b396.js}
  21. +5 −5 doc/sample_html/function_index.html
  22. +5 −5 doc/sample_html/index.html
  23. +1 −1 doc/sample_html/status.json
  24. +5 −5 doc/sample_html/z_7b071bdc2a35fa80___init___py.html
  25. +5 −5 doc/sample_html/z_7b071bdc2a35fa80___main___py.html
  26. +5 −5 doc/sample_html/z_7b071bdc2a35fa80_cogapp_py.html
  27. +5 −5 doc/sample_html/z_7b071bdc2a35fa80_makefiles_py.html
  28. +5 −5 doc/sample_html/z_7b071bdc2a35fa80_test_cogapp_py.html
  29. +5 −5 doc/sample_html/z_7b071bdc2a35fa80_test_makefiles_py.html
  30. +5 −5 doc/sample_html/z_7b071bdc2a35fa80_test_whiteutils_py.html
  31. +5 −5 doc/sample_html/z_7b071bdc2a35fa80_utils_py.html
  32. +5 −5 doc/sample_html/z_7b071bdc2a35fa80_whiteutils_py.html
  33. +1 −0 igor.py
  34. +2 −2 lab/extract_code.py
  35. +14 −8 lab/parser.py
  36. +3 −10 tests/coveragetest.py
  37. +16 −0 tests/gold/html/support/coverage_html.js
  38. +9 −4 tests/helpers.py
  39. +4 −24 tests/test_coverage.py
  40. +49 −22 tests/test_parser.py
  41. +28 −0 tests/test_report.py
  42. +7 −0 tests/test_setup.py
  43. +4 −2 tox.ini
1 change: 1 addition & 0 deletions .github/workflows/python-nightly.yml
Original file line number Diff line number Diff line change
@@ -58,6 +58,7 @@ jobs:
# https://launchpad.net/~deadsnakes/+archive/ubuntu/nightly/+packages
- "3.12-dev"
- "3.13-dev"
- "3.14-dev"
# https://github.com/actions/setup-python#available-versions-of-pypy
- "pypy-3.8-nightly"
- "pypy-3.9-nightly"
30 changes: 30 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -22,6 +22,36 @@ upgrading your version of coverage.py.
.. scriv-start-here
.. _changes_7-5-2:

Version 7.5.2 — 2024-05-24
--------------------------

- Fix: nested matches of exclude patterns could exclude too much code, as
reported in `issue 1779`_. This is now fixed.

- Changed: previously, coverage.py would consider a module docstring to be an
executable statement if it appeared after line 1 in the file, but not
executable if it was the first line. Now module docstrings are never counted
as executable statements. This can change coverage.py's count of the number
of statements in a file, which can slightly change the coverage percentage
reported.

- In the HTML report, the filter term and "hide covered" checkbox settings are
remembered between viewings, thanks to `Daniel Diniz <pull 1776_>`_.

- Python 3.13.0b1 is supported.

- Fix: parsing error handling is improved to ensure bizarre source files are
handled gracefully, and to unblock oss-fuzz fuzzing, thanks to `Liam DeVoe
<pull 1788_>`_. Closes `issue 1787`_.

.. _pull 1776: https://github.com/nedbat/coveragepy/pull/1776
.. _issue 1779: https://github.com/nedbat/coveragepy/issues/1779
.. _issue 1787: https://github.com/nedbat/coveragepy/issues/1787
.. _pull 1788: https://github.com/nedbat/coveragepy/pull/1788


.. _changes_7-5-1:

Version 7.5.1 — 2024-05-04
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
@@ -132,6 +132,7 @@ Latrice Wilgus
Leonardo Pistone
Lewis Gaul
Lex Berezhny
Liam DeVoe
Loïc Dachary
Lorenzo Micò
Louis Heredero
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ Coverage.py runs on these versions of Python:

.. PYVERSIONS
* Python 3.8 through 3.12, and 3.13.0a6 and up.
* Python 3.8 through 3.12, and 3.13.0b1 and up.
* PyPy3 versions 3.8 through 3.10.

Documentation is on `Read the Docs`_. Code repository and issue tracker are on
2 changes: 1 addition & 1 deletion coverage/html.py
Original file line number Diff line number Diff line change
@@ -597,7 +597,7 @@ def write_index_page(self, index_page: IndexPage, **kwargs: str) -> str:
"regions": index_page.summaries,
"totals": index_page.totals,
"noun": index_page.noun,
"column2": index_page.noun if index_page.noun != "file" else "",
"region_noun": index_page.noun if index_page.noun != "file" else "",
"skip_covered": self.skip_covered,
"skipped_covered_msg": skipped_covered_msg,
"skipped_empty_msg": skipped_empty_msg,
16 changes: 16 additions & 0 deletions coverage/htmlfiles/coverage_html.js
Original file line number Diff line number Diff line change
@@ -125,6 +125,16 @@ coverage.assign_shortkeys = function () {

// Create the events for the filter box.
coverage.wire_up_filter = function () {
// Populate the filter and hide100 inputs if there are saved values for them.
const saved_filter_value = localStorage.getItem(coverage.FILTER_STORAGE);
if (saved_filter_value) {
document.getElementById("filter").value = saved_filter_value;
}
const saved_hide100_value = localStorage.getItem(coverage.HIDE100_STORAGE);
if (saved_hide100_value) {
document.getElementById("hide100").checked = JSON.parse(saved_hide100_value);
}

// Cache elements.
const table = document.querySelector("table.index");
const table_body_rows = table.querySelectorAll("tbody tr");
@@ -138,8 +148,12 @@ coverage.wire_up_filter = function () {
totals[totals.length - 1] = { "numer": 0, "denom": 0 }; // nosemgrep: eslint.detect-object-injection

var text = document.getElementById("filter").value;
// Store filter value
localStorage.setItem(coverage.FILTER_STORAGE, text);
const casefold = (text === text.toLowerCase());
const hide100 = document.getElementById("hide100").checked;
// Store hide value.
localStorage.setItem(coverage.HIDE100_STORAGE, JSON.stringify(hide100));

// Hide / show elements.
table_body_rows.forEach(row => {
@@ -240,6 +254,8 @@ coverage.wire_up_filter = function () {
document.getElementById("filter").dispatchEvent(new Event("input"));
document.getElementById("hide100").dispatchEvent(new Event("input"));
};
coverage.FILTER_STORAGE = "COVERAGE_FILTER_VALUE";
coverage.HIDE100_STORAGE = "COVERAGE_HIDE100_VALUE";

// Set up the click-to-sort columns.
coverage.wire_up_sorting = function () {
10 changes: 5 additions & 5 deletions coverage/htmlfiles/index.html
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ <h1>{{ title|escape }}:
<div class="keyhelp">
<p>
<kbd>f</kbd>
{% if column2 %}
{% if region_noun %}
<kbd>n</kbd>
{% endif %}
<kbd>s</kbd>
@@ -83,8 +83,8 @@ <h2>
{# The title="" attr doesn't work in Safari. #}
<tr class="tablehead" title="Click to sort">
<th id="file" class="name left" aria-sort="none" data-shortcut="f">File<span class="arrows"></span></th>
{% if column2 %}
<th id="region" class="name left" aria-sort="none" data-default-sort-order="ascending" data-shortcut="n">{{ column2 }}<span class="arrows"></span></th>
{% if region_noun %}
<th id="region" class="name left" aria-sort="none" data-default-sort-order="ascending" data-shortcut="n">{{ region_noun }}<span class="arrows"></span></th>
{% endif %}
<th id="statements" aria-sort="none" data-default-sort-order="descending" data-shortcut="s">statements<span class="arrows"></span></th>
<th id="missing" aria-sort="none" data-default-sort-order="descending" data-shortcut="m">missing<span class="arrows"></span></th>
@@ -100,7 +100,7 @@ <h2>
{% for region in regions %}
<tr class="region">
<td class="name left"><a href="{{region.url}}">{{region.file}}</a></td>
{% if column2 %}
{% if region_noun %}
<td class="name left"><a href="{{region.url}}">{{region.description}}</a></td>
{% endif %}
<td>{{region.nums.n_statements}}</td>
@@ -117,7 +117,7 @@ <h2>
<tfoot>
<tr class="total">
<td class="name left">Total</td>
{% if column2 %}
{% if region_noun %}
<td class="name left">&nbsp;</td>
{% endif %}
<td>{{totals.n_statements}}</td>
15 changes: 1 addition & 14 deletions coverage/misc.py
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@
import importlib
import importlib.util
import inspect
import locale
import os
import os.path
import re
@@ -22,7 +21,7 @@

from types import ModuleType
from typing import (
Any, IO, Iterable, Iterator, Mapping, NoReturn, Sequence, TypeVar,
Any, Iterable, Iterator, Mapping, NoReturn, Sequence, TypeVar,
)

from coverage.exceptions import CoverageException
@@ -156,18 +155,6 @@ def ensure_dir_for_file(path: str) -> None:
ensure_dir(os.path.dirname(path))


def output_encoding(outfile: IO[str] | None = None) -> str:
"""Determine the encoding to use for output written to `outfile` or stdout."""
if outfile is None:
outfile = sys.stdout
encoding = (
getattr(outfile, "encoding", None) or
getattr(sys.__stdout__, "encoding", None) or
locale.getpreferredencoding()
)
return encoding


class Hasher:
"""Hashes Python data for fingerprinting."""
def __init__(self) -> None:
Loading