Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage.py 7.0.2 reports fewer statements than 7.0.1 under Python 3.7 #1524

Closed
bhrutledge opened this issue Jan 3, 2023 · 8 comments
Closed
Labels
bug Something isn't working fixed

Comments

@bhrutledge
Copy link

Describe the bug

Twine's scheduled CI failed this morning, because the coverage percentage dropped below the threshold under Python 3.7 (GHA), with 1785 statements executed. The day before, it passed (GHA), with 1807 statements executed. There were no commits in between. The only difference that I'm aware of is the release of Coverage.py 7.0.2, but I don't see any red flags in the release notes.

To Reproduce

  1. What version of Python are you using?

    3.7 and 3.8

  2. What version of coverage.py shows the problem? The output of coverage debug sys is helpful.

    7.0.2

  3. What versions of what packages do you have installed? The output of pip freeze is helpful.

    % .tox/py37/bin/pip freeze
     attrs==22.2.0
     bleach==5.0.1
     build==0.9.0
     certifi==2022.12.7
     charset-normalizer==2.1.1
     commonmark==0.9.1
     coverage==7.0.2
     docutils==0.19
     exceptiongroup==1.1.0
     idna==3.4
     importlib-metadata==6.0.0
     importlib-resources==5.10.2
     iniconfig==1.1.1
     jaraco.classes==3.2.3
     keyring==23.13.1
     more-itertools==9.0.0
     packaging==22.0
     pep517==0.13.0
     pkginfo==1.9.2
     pluggy==1.0.0
     pretend==1.0.9
     Pygments==2.14.0
     pytest==7.2.0
     pytest-socket==0.5.1
     readme-renderer==37.3
     requests==2.28.1
     requests-toolbelt==0.10.1
     rfc3986==2.0.0
     rich==13.0.0
     six==1.16.0
     tomli==2.0.1
     twine @ file:///Users/bhrutledge/Dev/twine/.tox/.tmp/package/35/twine-4.0.3.dev21%2Bg89fba32.d20230103.tar.gz
     typing_extensions==4.4.0
     urllib3==1.26.13
     webencodings==0.5.1
     zipp==3.11.0
    
  4. What code shows the problem?

    https://github.com/pypa/twine/tree/89fba32c3cf56ff6b02c691154b3de7faf7def04

  5. What commands did you run?

    I'm able to reproduce this locally by running tox -e py37 and changing the coverage requirement in deps (e.g. to coverage==7.0.1 and coverage<7).

Expected behavior

The number of executed statements should be the same as previous versions.

Additional context

There's no change in statements from Coverage.py 6.5.0 to 7.0.1; both report 1807.

Also maybe worth noting that py37 has always seemed to be lower; py38 and greater seem to consistently execute 1856 statements, with no change across Coverage.py versions.

@bhrutledge bhrutledge added bug Something isn't working needs triage labels Jan 3, 2023
@nedbat
Copy link
Owner

nedbat commented Jan 3, 2023

Could you produce an HTML report for each version of coverage? Then we can see where the differences are. I don't know why the number of statements would differ.

@bhrutledge
Copy link
Author

Here you go, with the statements per version:

Version Total twine/ tests/
twine-htmlcov-701-py37.zip 1807 898 909
twine-htmlcov-703-py37.zip 1785 877 908
twine-htmlcov-703-py38.zip 1856 898 958

It's interesting how the twine/ statements are the same between 701-py37 and 703-py38, but the tests/ are different.

I omitted 701-py38 because it has the results as 703-py38.

nedbat added a commit that referenced this issue Jan 9, 2023
@nedbat
Copy link
Owner

nedbat commented Jan 9, 2023

I have spent some time bisecting, etc, and have narrowed this down to an "impossible" situation.

With coverage.py 7.0.1, twine/settings.py in the HTML report is reported as having 81 statements.

If I add from __future__ import annotations to my parser.py, then it's reported as having 75 statements. How can this be? parser.py has no type annotations, so how can a __future__ import about annotations change anything?

@bhrutledge can you confirm my results? Use this to install it:

pip install git+https://github.com/nedbat/coveragepy@nedbat/wtf2-1524#egg=coverage==0.0

Here's the diff: https://github.com/nedbat/coveragepy/compare/7.0.1..nedbat/wtf2-1524

@sco1
Copy link

sco1 commented Jan 9, 2023

Perhaps it has something to do with the decorator parsing? Looking at PythonParser.statemtents for Twine's settings.py with & without the future import in parser.py gives a difference of [129, 134, 145, 149, 156, 274], which are all line numbers around the decorators.

edit: Still doing digging but it looks like it starts to diverge when updating raw_statements here:

if not empty:
byte_parser = ByteParser(self.text, filename=self.filename)
self.raw_statements.update(byte_parser._find_statements())

Without the future import there are 189 raw statements, dropping to 178 once the future import is added.

@nedbat
Copy link
Owner

nedbat commented Jan 9, 2023

The mystery was solved by @JelleZijlstra in the Python Discord: the compile builtin inherits flags from the code calling it, so the twine code had the __future__ applied. The twine code has annotations, but does not use the __future__ import, so it was changed as a result.

I will add the flag to compile() that disables the inheritance, and then dig into how the annotations change the coverage reporting as a separate issue.

@nedbat
Copy link
Owner

nedbat commented Jan 10, 2023

This is fixed in commit 880a64a.

@nedbat nedbat closed this as completed Jan 10, 2023
@nedbat nedbat added the fixed label Jan 10, 2023
@nedbat
Copy link
Owner

nedbat commented Jan 11, 2023

This is now released as part of coverage 7.0.5.

@bhrutledge
Copy link
Author

Thank you! Confirmed this fixes the issue.

RobertCraigie referenced this issue in RobertCraigie/prisma-client-py Feb 1, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [coverage](https://togithub.com/nedbat/coveragepy) | `==6.5.0` ->
`==7.1.0` |
[![age](https://badges.renovateapi.com/packages/pypi/coverage/7.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/coverage/7.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/coverage/7.1.0/compatibility-slim/6.5.0)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/coverage/7.1.0/confidence-slim/6.5.0)](https://docs.renovatebot.com/merge-confidence/)
|
| [mkdocs-material](https://togithub.com/squidfunk/mkdocs-material) |
`==8.5.11` -> `==9.0.9` |
[![age](https://badges.renovateapi.com/packages/pypi/mkdocs-material/9.0.9/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/mkdocs-material/9.0.9/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/mkdocs-material/9.0.9/compatibility-slim/8.5.11)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/mkdocs-material/9.0.9/confidence-slim/8.5.11)](https://docs.renovatebot.com/merge-confidence/)
|
| [mock](http://mock.readthedocs.org/en/latest/)
([source](https://togithub.com/testing-cabal/mock)) | `==4.0.3` ->
`==5.0.1` |
[![age](https://badges.renovateapi.com/packages/pypi/mock/5.0.1/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/mock/5.0.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/mock/5.0.1/compatibility-slim/4.0.3)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/mock/5.0.1/confidence-slim/4.0.3)](https://docs.renovatebot.com/merge-confidence/)
|
| [pre-commit](https://togithub.com/pre-commit/pre-commit) | `==2.21.0`
-> `==3.0.2` |
[![age](https://badges.renovateapi.com/packages/pypi/pre-commit/3.0.2/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/pre-commit/3.0.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/pre-commit/3.0.2/compatibility-slim/2.21.0)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/pre-commit/3.0.2/confidence-slim/2.21.0)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>nedbat/coveragepy</summary>

###
[`v7.1.0`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-710--2023-01-24)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.0.5...7.1.0)

- Added: the debug output file can now be specified with `[run]
debug_file`
    in the configuration file.  Closes `issue 1319`\_.

- Performance: fixed a slowdown with dynamic contexts that's been around
since
6.4.3. The fix closes `issue 1538`*. Thankfully this doesn't break the
`Cython change`* that fixed `issue 972`\_. Thanks to Mathieu Kniewallner
for
    the deep investigative work and comprehensive issue report.

-   Typing: all product and test code has type annotations.

.. \_Cython
change:[https://github.com/nedbat/coveragepy/pull/1347](https://togithub.com/nedbat/coveragepy/pull/1347)7
.. \_issue
972[https://github.com/nedbat/coveragepy/issues/972](https://togithub.com/nedbat/coveragepy/issues/972)72
.. \_issue
131[https://github.com/nedbat/coveragepy/issues/1319](https://togithub.com/nedbat/coveragepy/issues/1319)319
.. \_issue
15[https://github.com/nedbat/coveragepy/issues/1538](https://togithub.com/nedbat/coveragepy/issues/1538)1538

.. \_changes\_7-0-5:

###
[`v7.0.5`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-705--2023-01-10)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.0.4...7.0.5)

- Fix: On Python 3.7, a file with type annotations but no `from
__future__
import annotations` would be missing statements in the coverage report.
This
    is now fixed, closing `issue 1524`\_.

.. \_issue
1524:[https://github.com/nedbat/coveragepy/issues/1524](https://togithub.com/nedbat/coveragepy/issues/1524)4

.. \_changes\_7-0-4:

###
[`v7.0.4`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-704--2023-01-07)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.0.3...7.0.4)

- Performance: an internal cache of file names was accidentally
disabled,
resulting in sometimes drastic reductions in performance. This is now
fixed,
closing `issue 1527`\_. Thanks to Ivan Ciuvalschii for the reproducible
test
    case.

.. \_issue
1527:[https://github.com/nedbat/coveragepy/issues/1527](https://togithub.com/nedbat/coveragepy/issues/1527)7

.. \_changes\_7-0-3:

###
[`v7.0.3`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-703--2023-01-03)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.0.2...7.0.3)

- Fix: when using pytest-cov or pytest-xdist, or perhaps both, the
combining
step could fail with `assert row is not None` using 7.0.2. This was due
to
a race condition that has always been possible and is still possible. In
7.0.1 and before, the error was silently swallowed by the combining
code.
Now it will produce a message "Couldn't combine data file" and ignore
the
    data file as it used to do before 7.0.2.  Closes `issue 1522`\_.

.. \_issue
1522:[https://github.com/nedbat/coveragepy/issues/1522](https://togithub.com/nedbat/coveragepy/issues/1522)2

.. \_changes\_7-0-2:

###
[`v7.0.2`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-702--2023-01-02)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.0.1...7.0.2)

- Fix: when using the `[run] relative_files = True` setting, a relative
    `[paths]` pattern was still being made absolute.  This is now fixed,
    closing `issue 1519`\_.

- Fix: if Python doesn't provide tomllib, then TOML configuration files
can
    only be read if coverage.py is installed with the `[toml]` extra.
Coverage.py will raise an error if TOML support is not installed when it
sees
    your settings are in a .toml file. But it didn't understand that
`[tools.coverage]` was a valid section header, so the error wasn't
reported
if you used that header, and settings were silently ignored. This is now
    fixed, closing `issue 1516`\_.

- Fix: adjusted how decorators are traced on PyPy 7.3.10, fixing `issue
1515`\_.

-   Fix: the `coverage lcov` report did not properly implement the
    `--fail-under=MIN` option.  This has been fixed.

- Refactor: added many type annotations, including a number of
refactorings.
This should not affect outward behavior, but they were a bit invasive in
some
    places, so keep your eyes peeled for oddities.

- Refactor: removed the vestigial and long untested support for Jython
and
    IronPython.

.. \_issue
1515:[https://github.com/nedbat/coveragepy/issues/1515](https://togithub.com/nedbat/coveragepy/issues/1515)5
.. \_issue
1516[https://github.com/nedbat/coveragepy/issues/1516](https://togithub.com/nedbat/coveragepy/issues/1516)16
.. \_issue
151[https://github.com/nedbat/coveragepy/issues/1519](https://togithub.com/nedbat/coveragepy/issues/1519)519

.. \_changes\_7-0-1:

###
[`v7.0.1`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-701--2022-12-23)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.0.0...7.0.1)

- When checking if a file mapping resolved to a file that exists, we
weren't
considering files in .whl files. This is now fixed, closing `issue
1511`\_.

- File pattern rules were too strict, forbidding plus signs and curly
braces in
directory and file names. This is now fixed, closing `issue 1513`\_.

-   Unusual Unicode or control characters in source files could prevent
    reporting.  This is now fixed, closing `issue 1512`\_.

- The PyPy wheel now installs on PyPy 3.7, 3.8, and 3.9, closing `issue
1510`\_.

.. \_issue
1510:[https://github.com/nedbat/coveragepy/issues/1510](https://togithub.com/nedbat/coveragepy/issues/1510)0
.. \_issue
1511[https://github.com/nedbat/coveragepy/issues/1511](https://togithub.com/nedbat/coveragepy/issues/1511)11
.. \_issue
151[https://github.com/nedbat/coveragepy/issues/1512](https://togithub.com/nedbat/coveragepy/issues/1512)512
.. \_issue
15[https://github.com/nedbat/coveragepy/issues/1513](https://togithub.com/nedbat/coveragepy/issues/1513)1513

.. \_changes\_7-0-0:

###
[`v7.0.0`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-700--2022-12-18)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/6.5.0...7.0.0)

Nothing new beyond 7.0.0b1.

.. \_changes\_7-0-0b1:

</details>

<details>
<summary>squidfunk/mkdocs-material</summary>

###
[`v9.0.9`](https://togithub.com/squidfunk/mkdocs-material/releases/tag/9.0.9):
mkdocs-material-9.0.9

[Compare
Source](https://togithub.com/squidfunk/mkdocs-material/compare/9.0.8...9.0.9)

-   Updated Bulgarian translations
-   Updated Chinese (Simplified) translations
-   Updated Dutch translations
-   Updated Hindi translations
-   Updated Japanese translations
-   Updated Polish translations

###
[`v9.0.8`](https://togithub.com/squidfunk/mkdocs-material/releases/tag/9.0.8):
mkdocs-material-9.0.8

[Compare
Source](https://togithub.com/squidfunk/mkdocs-material/compare/9.0.7...9.0.8)

-   Updated Croatian translations
-   Updated French translations
-   Updated Hungarian translations
-   Updated Portuguese (Brasilian) translations
-   Updated Spanish translations
-   Updated Ukrainian translations
-   Updated Urdu translations
-   Updated Vietnamese translations

###
[`v9.0.7`](https://togithub.com/squidfunk/mkdocs-material/releases/tag/9.0.7):
mkdocs-material-9.0.7

[Compare
Source](https://togithub.com/squidfunk/mkdocs-material/compare/9.0.6...9.0.7)

-   Improved accessibility of sidebar navigation
-   Moved all translations into community edition
-   Updated Polish and Portuguese (Brasilian) translations
-   Fixed info plugin terminating on subsequent reload when serving
- Fixed
[#&#8203;4910](https://togithub.com/squidfunk/mkdocs-material/issues/4910):
Sidebar navigation labels have invalid ARIA roles
- Fixed
[#&#8203;4884](https://togithub.com/squidfunk/mkdocs-material/issues/4884):
Search query terms can't be separated by colons

###
[`v9.0.6`](https://togithub.com/squidfunk/mkdocs-material/releases/tag/9.0.6):
mkdocs-material-9.0.6

[Compare
Source](https://togithub.com/squidfunk/mkdocs-material/compare/9.0.5...9.0.6)

- Fixed
[#&#8203;4883](https://togithub.com/squidfunk/mkdocs-material/issues/4883):
Automatically disable info plugin when serving
- Fixed
[#&#8203;4885](https://togithub.com/squidfunk/mkdocs-material/issues/4885):
Search plugin crashes in some exotic cases (9.0.3 regression)

###
[`v9.0.5`](https://togithub.com/squidfunk/mkdocs-material/releases/tag/9.0.5):
mkdocs-material-9.0.5

[Compare
Source](https://togithub.com/squidfunk/mkdocs-material/compare/9.0.4...9.0.5)

- Fixed
[#&#8203;4842](https://togithub.com/squidfunk/mkdocs-material/issues/4842):
Improved accessibility of search result list

###
[`v9.0.4`](https://togithub.com/squidfunk/mkdocs-material/releases/tag/9.0.4):
mkdocs-material-9.0.4

[Compare
Source](https://togithub.com/squidfunk/mkdocs-material/compare/9.0.3...9.0.4)

- Fixed
[#&#8203;4823](https://togithub.com/squidfunk/mkdocs-material/issues/4823):
Improved contrast ratio in footer (9.0.2 regression)
- Fixed
[#&#8203;4832](https://togithub.com/squidfunk/mkdocs-material/issues/4832):
Set navigation items back to black (9.0.3 regression)
- Fixed
[#&#8203;4843](https://togithub.com/squidfunk/mkdocs-material/issues/4843):
Emojis broken due to `maxcdn.com` shutting down
-   Upgraded Python Markdown Extensions to 9.9.1

###
[`v9.0.3`](https://togithub.com/squidfunk/mkdocs-material/releases/tag/9.0.3):
mkdocs-material-9.0.3

[Compare
Source](https://togithub.com/squidfunk/mkdocs-material/compare/9.0.2...9.0.3)

-   Improved discernability of section index pages in navigation
-   Improved collapsing of adjacent whitespace in search plugin
-   Updated Indonesian translations
-   Fixed view source of this page button when edit URL points to blob
- Fixed
[#&#8203;4829](https://togithub.com/squidfunk/mkdocs-material/issues/4829):
Search overlay does not close for active anchor result
- Fixed
[#&#8203;4824](https://togithub.com/squidfunk/mkdocs-material/issues/4824):
Search plugin crashes for `h[1-6]` contained in other elements
- Fixed
[#&#8203;4804](https://togithub.com/squidfunk/mkdocs-material/issues/4804):
Nested navigation items not expandable with keyboard
- Fixed
[#&#8203;4689](https://togithub.com/squidfunk/mkdocs-material/issues/4689):
anchor tracking not working for anchors in tables
-   Upgraded to Mermaid 9.3.0

###
[`v9.0.2`](https://togithub.com/squidfunk/mkdocs-material/releases/tag/9.0.2):
mkdocs-material-9.0.2

[Compare
Source](https://togithub.com/squidfunk/mkdocs-material/compare/9.0.1...9.0.2)

- Fixed
[#&#8203;4823](https://togithub.com/squidfunk/mkdocs-material/issues/4823):
Improved contrast ratio in footer to meet WCAG guidelines
- Fixed
[#&#8203;4819](https://togithub.com/squidfunk/mkdocs-material/issues/4819):
Social plugin crashes when card generation is disabled
- Fixed
[#&#8203;4817](https://togithub.com/squidfunk/mkdocs-material/issues/4817):
Search plugin crashes on numeric page titles in `nav`

###
[`v9.0.1`](https://togithub.com/squidfunk/mkdocs-material/releases/tag/9.0.1):
mkdocs-material-9.0.1

[Compare
Source](https://togithub.com/squidfunk/mkdocs-material/compare/9.0.0...9.0.1)

-   Removed `pipdeptree` dependency for built-in info plugin
-   Fixed appearance of linked tags when hovered (9.0.0 regression)
- Fixed
[#&#8203;4810](https://togithub.com/squidfunk/mkdocs-material/issues/4810):
Abbreviations run out of screen on touch devices
- Fixed
[#&#8203;4813](https://togithub.com/squidfunk/mkdocs-material/issues/4813):
View source and edit button links are the same

###
[`v9.0.0`](https://togithub.com/squidfunk/mkdocs-material/releases/tag/9.0.0):
mkdocs-material-9.0.0

[Compare
Source](https://togithub.com/squidfunk/mkdocs-material/compare/8.5.11...9.0.0)

**Additions and improvements**

-   Added support for rich search previews
-   Added support for tokenizer lookahead
-   Added support for better search highlighting
-   Added support for excluding content from search
-   Added support for configurable search pipeline
-   Added support for offline search via offline plugin
-   Added support for multiple instances of built-in tags plugin
-   Added support for removing copy-to-clipboard button
-   Added support for removing footer navigation
-   Added support for button to view the source of a page
-   Improved readability of query string for search sharing
-   Improved stability of search plugin when using `--dirtyreload`
-   Improved search result group button, now sticky and stable
-   Updated Norwegian translations
-   Updated MkDocs to 1.4.2

**Removals**

-   Removed deprecated alternative admonition qualifiers
-   Removed `:is()` selectors (in output) for easier overriding
-   Removed `.title` suffix on translations
-   Removed legacy method for providing page title in feedback URL
-   Removed support for indexing only titles in search
-   Removed support for custom search transforms
-   Removed support for custom search workers
-   Removed temporary snow feature (easter egg)

**Fixes**

-   Fixed Norwegian and Korean language code
-   Fixed detection of composition events in search interface
-   Fixed search plugin not using title set via front matter
-   Fixed search highlighting of tags
-   Fixed search sharing URL using post transformed string
-   Fixed theme-color meta tag getting out-of-sync with palette toggle
-   Fixed prev/next page keyboard navigation when footer is not present
-   Fixed overflowing navigation tabs not being scrollable
-   Fixed inclusion of code block line numbers from search

</details>

<details>
<summary>testing-cabal/mock</summary>

###
[`v5.0.1`](https://togithub.com/testing-cabal/mock/blob/HEAD/CHANGELOG.rst#&#8203;501)

[Compare
Source](https://togithub.com/testing-cabal/mock/compare/5.0.0...5.0.1)

- [gh-100740](https://togithub.com/testing-cabal/mock/issues/100740):
Fix `unittest.mock.Mock` not respecting the spec for
    attribute names prefixed with `assert`.

- [gh-100690](https://togithub.com/testing-cabal/mock/issues/100690):
`Mock` objects which are not unsafe will now raise an
`AttributeError` when accessing an attribute that matches the name of an
    assertion but without the prefix `assert_`, e.g. accessing
`called_once` instead of `assert_called_once`. This is in addition to
this already happening for accessing attributes with prefixes `assert`,
    `assret`, `asert`, `aseert`, and `assrt`.

- [gh-96127](https://togithub.com/testing-cabal/mock/issues/96127):
`inspect.signature` was raising `TypeError` on call with
mock objects. Now it correctly returns `(*args, **kwargs)` as infered
    signature.

###
[`v5.0.0`](https://togithub.com/testing-cabal/mock/blob/HEAD/CHANGELOG.rst#&#8203;500)

[Compare
Source](https://togithub.com/testing-cabal/mock/compare/4.0.3...5.0.0)

- [gh-98624](https://togithub.com/testing-cabal/mock/issues/98624): Add
a mutex to unittest.mock.NonCallableMock to protect
    concurrent access to mock attributes.

- bpo-43478: Mocks can no longer be used as the specs for other Mocks.
As a
result, an already-mocked object cannot have an attribute mocked using
`autospec=True` or be the subject of a `create_autospec(...)` call. This
can uncover bugs in tests since these Mock-derived Mocks will always
pass
    certain tests (e.g. isinstance) and builtin assert functions (e.g.
    assert_called_once_with) will unconditionally pass.

- bpo-45156: Fixes infinite loop on :func:`unittest.mock.seal` of mocks
    created by :func:`~unittest.create_autospec`.

-   bpo-41403: Make :meth:`mock.patch` raise a :exc:`TypeError` with a
relevant error message on invalid arg. Previously it allowed a cryptic
    :exc:`AttributeError` to escape.

- [gh-91803](https://togithub.com/testing-cabal/mock/issues/91803): Fix
an error when using a method of objects mocked with
    :func:`unittest.mock.create_autospec` after it was sealed with
    :func:`unittest.mock.seal` function.

- bpo-41877: AttributeError for suspected misspellings of assertions on
mocks are now pointing out that the cause are misspelled assertions and
also what to do if the misspelling is actually an intended attribute
name.
The unittest.mock document is also updated to reflect the current set of
    recognised misspellings.

- bpo-43478: Mocks can no longer be provided as the specs for other
Mocks.
As a result, an already-mocked object cannot be passed to `mock.Mock()`.
This can uncover bugs in tests since these Mock-derived Mocks will
always
pass certain tests (e.g. isinstance) and builtin assert functions (e.g.
    assert_called_once_with) will unconditionally pass.

-   bpo-45010: Remove support of special method `__div__` in
    :mod:`unittest.mock`. It is not used in Python 3.

- [gh-84753](https://togithub.com/testing-cabal/mock/issues/84753):
:func:`inspect.iscoroutinefunction` now properly returns
`True` when an instance of :class:`unittest.mock.AsyncMock` is passed to
    it.  This makes it consistent with behavior of
    :func:`asyncio.iscoroutinefunction`.  Patch by Mehdi ABAAKOUK.

-   bpo-46852: Remove the undocumented private `float.__set_format__()`
method, previously known as `float.__setformat__()` in Python 3.7. Its
docstring said: "You probably don't want to use this function. It exists
    mainly to be used in Python's test suite." Patch by Victor Stinner.

- [gh-98086](https://togithub.com/testing-cabal/mock/issues/98086): Make
sure `patch.dict()` can be applied on async functions.

- [gh-100287](https://togithub.com/testing-cabal/mock/issues/100287):
Fix the interaction of :func:`unittest.mock.seal` with
    :class:`unittest.mock.AsyncMock`.

- [gh-83076](https://togithub.com/testing-cabal/mock/issues/83076):
Instantiation of `Mock()` and `AsyncMock()` is now 3.8x
    faster.

- bpo-41877: A check is added against misspellings of autospect,
auto_spec
    and set_spec being passed as arguments to patch, patch.object and
    create_autospec.

</details>

<details>
<summary>pre-commit/pre-commit</summary>

###
[`v3.0.2`](https://togithub.com/pre-commit/pre-commit/blob/HEAD/CHANGELOG.md#&#8203;302---2023-01-29)

[Compare
Source](https://togithub.com/pre-commit/pre-commit/compare/v3.0.1...v3.0.2)

\==================

##### Fixes

-   Prevent local `Gemfile` from interfering with hook execution.
- [#&#8203;2727](https://togithub.com/pre-commit/pre-commit/issues/2727)
PR by [@&#8203;asottile](https://togithub.com/asottile).
-   Fix `language: r`, `repo: local` hooks
-
[pre-commit-ci/issues#&#8203;107](https://togithub.com/pre-commit-ci/issues/issues/107)
by [@&#8203;lorenzwalthert](https://togithub.com/lorenzwalthert).
- [#&#8203;2728](https://togithub.com/pre-commit/pre-commit/issues/2728)
PR by [@&#8203;asottile](https://togithub.com/asottile).

###
[`v3.0.1`](https://togithub.com/pre-commit/pre-commit/blob/HEAD/CHANGELOG.md#&#8203;301---2023-01-26)

[Compare
Source](https://togithub.com/pre-commit/pre-commit/compare/v3.0.0...v3.0.1)

\==================

##### Fixes

-   Ensure coursier hooks are available offline after install.
- [#&#8203;2723](https://togithub.com/pre-commit/pre-commit/issues/2723)
PR by [@&#8203;asottile](https://togithub.com/asottile).

###
[`v3.0.0`](https://togithub.com/pre-commit/pre-commit/blob/HEAD/CHANGELOG.md#&#8203;300---2023-01-23)

[Compare
Source](https://togithub.com/pre-commit/pre-commit/compare/v2.21.0...v3.0.0)

\==================

##### Features

-   Make `language: golang` bootstrap `go` if not present.
- [#&#8203;2651](https://togithub.com/pre-commit/pre-commit/issues/2651)
PR by [@&#8203;taoufik07](https://togithub.com/taoufik07).
- [#&#8203;2649](https://togithub.com/pre-commit/pre-commit/issues/2649)
issue by [@&#8203;taoufik07](https://togithub.com/taoufik07).
- `language: coursier` now supports `additional_dependencies` and `repo:
local`
- [#&#8203;2702](https://togithub.com/pre-commit/pre-commit/issues/2702)
PR by [@&#8203;asottile](https://togithub.com/asottile).
-   Upgrade `ruby-build` to `20221225`.
- [#&#8203;2718](https://togithub.com/pre-commit/pre-commit/issues/2718)
PR by [@&#8203;jalessio](https://togithub.com/jalessio).

##### Fixes

-   Improve error message for invalid yaml for `pre-commit autoupdate`.
- [#&#8203;2686](https://togithub.com/pre-commit/pre-commit/issues/2686)
PR by [@&#8203;asottile](https://togithub.com/asottile).
- [#&#8203;2685](https://togithub.com/pre-commit/pre-commit/issues/2685)
issue by
[@&#8203;CarstenGrohmann](https://togithub.com/CarstenGrohmann).
-   `repo: local` no longer provisions an empty `git` repo.
- [#&#8203;2699](https://togithub.com/pre-commit/pre-commit/issues/2699)
PR by [@&#8203;asottile](https://togithub.com/asottile).

##### Updating

-   Drop support for python<3.8
- [#&#8203;2655](https://togithub.com/pre-commit/pre-commit/issues/2655)
PR by [@&#8203;asottile](https://togithub.com/asottile).
- Drop support for top-level list, use `pre-commit migrate-config` to
update.
- [#&#8203;2656](https://togithub.com/pre-commit/pre-commit/issues/2656)
PR by [@&#8203;asottile](https://togithub.com/asottile).
- Drop support for `sha` to specify revision, use `pre-commit
migrate-config`
    to update.
- [#&#8203;2657](https://togithub.com/pre-commit/pre-commit/issues/2657)
PR by [@&#8203;asottile](https://togithub.com/asottile).
- Remove `pre-commit-validate-config` and
`pre-commit-validate-manifest`, use
`pre-commit validate-config` and `pre-commit validate-manifest` instead.
- [#&#8203;2658](https://togithub.com/pre-commit/pre-commit/issues/2658)
PR by [@&#8203;asottile](https://togithub.com/asottile).
-   `language: golang` hooks must use `go.mod` to specify dependencies
- [#&#8203;2672](https://togithub.com/pre-commit/pre-commit/issues/2672)
PR by [@&#8203;taoufik07](https://togithub.com/taoufik07).

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/RobertCraigie/prisma-client-py).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC42Mi4xIiwidXBkYXRlZEluVmVyIjoiMzQuMTE5LjAifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Robert Craigie <robert@craigie.dev>
allenporter referenced this issue in allenporter/flux-local Feb 6, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [coverage](https://togithub.com/nedbat/coveragepy) | `==6.4.2` ->
`==7.1.0` |
[![age](https://badges.renovateapi.com/packages/pypi/coverage/7.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/coverage/7.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/coverage/7.1.0/compatibility-slim/6.4.2)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/coverage/7.1.0/confidence-slim/6.4.2)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>nedbat/coveragepy</summary>

###
[`v7.1.0`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-710--2023-01-24)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.0.5...7.1.0)

- Added: the debug output file can now be specified with `[run]
debug_file`
    in the configuration file.  Closes `issue 1319`\_.

- Performance: fixed a slowdown with dynamic contexts that's been around
since
6.4.3. The fix closes `issue 1538`*. Thankfully this doesn't break the
`Cython change`* that fixed `issue 972`\_. Thanks to Mathieu Kniewallner
for
    the deep investigative work and comprehensive issue report.

-   Typing: all product and test code has type annotations.

.. \_Cython
change:[https://github.com/nedbat/coveragepy/pull/1347](https://togithub.com/nedbat/coveragepy/pull/1347)7
.. \_issue
972[https://github.com/nedbat/coveragepy/issues/972](https://togithub.com/nedbat/coveragepy/issues/972)72
.. \_issue
131[https://github.com/nedbat/coveragepy/issues/1319](https://togithub.com/nedbat/coveragepy/issues/1319)319
.. \_issue
15[https://github.com/nedbat/coveragepy/issues/1538](https://togithub.com/nedbat/coveragepy/issues/1538)1538

.. \_changes\_7-0-5:

###
[`v7.0.5`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-705--2023-01-10)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.0.4...7.0.5)

- Fix: On Python 3.7, a file with type annotations but no `from
__future__
import annotations` would be missing statements in the coverage report.
This
    is now fixed, closing `issue 1524`\_.

.. \_issue
1524:[https://github.com/nedbat/coveragepy/issues/1524](https://togithub.com/nedbat/coveragepy/issues/1524)4

.. \_changes\_7-0-4:

###
[`v7.0.4`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-704--2023-01-07)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.0.3...7.0.4)

- Performance: an internal cache of file names was accidentally
disabled,
resulting in sometimes drastic reductions in performance. This is now
fixed,
closing `issue 1527`\_. Thanks to Ivan Ciuvalschii for the reproducible
test
    case.

.. \_issue
1527:[https://github.com/nedbat/coveragepy/issues/1527](https://togithub.com/nedbat/coveragepy/issues/1527)7

.. \_changes\_7-0-3:

###
[`v7.0.3`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-703--2023-01-03)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.0.2...7.0.3)

- Fix: when using pytest-cov or pytest-xdist, or perhaps both, the
combining
step could fail with `assert row is not None` using 7.0.2. This was due
to
a race condition that has always been possible and is still possible. In
7.0.1 and before, the error was silently swallowed by the combining
code.
Now it will produce a message "Couldn't combine data file" and ignore
the
    data file as it used to do before 7.0.2.  Closes `issue 1522`\_.

.. \_issue
1522:[https://github.com/nedbat/coveragepy/issues/1522](https://togithub.com/nedbat/coveragepy/issues/1522)2

.. \_changes\_7-0-2:

###
[`v7.0.2`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-702--2023-01-02)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.0.1...7.0.2)

- Fix: when using the `[run] relative_files = True` setting, a relative
    `[paths]` pattern was still being made absolute.  This is now fixed,
    closing `issue 1519`\_.

- Fix: if Python doesn't provide tomllib, then TOML configuration files
can
    only be read if coverage.py is installed with the `[toml]` extra.
Coverage.py will raise an error if TOML support is not installed when it
sees
    your settings are in a .toml file. But it didn't understand that
`[tools.coverage]` was a valid section header, so the error wasn't
reported
if you used that header, and settings were silently ignored. This is now
    fixed, closing `issue 1516`\_.

- Fix: adjusted how decorators are traced on PyPy 7.3.10, fixing `issue
1515`\_.

-   Fix: the `coverage lcov` report did not properly implement the
    `--fail-under=MIN` option.  This has been fixed.

- Refactor: added many type annotations, including a number of
refactorings.
This should not affect outward behavior, but they were a bit invasive in
some
    places, so keep your eyes peeled for oddities.

- Refactor: removed the vestigial and long untested support for Jython
and
    IronPython.

.. \_issue
1515:[https://github.com/nedbat/coveragepy/issues/1515](https://togithub.com/nedbat/coveragepy/issues/1515)5
.. \_issue
1516[https://github.com/nedbat/coveragepy/issues/1516](https://togithub.com/nedbat/coveragepy/issues/1516)16
.. \_issue
151[https://github.com/nedbat/coveragepy/issues/1519](https://togithub.com/nedbat/coveragepy/issues/1519)519

.. \_changes\_7-0-1:

###
[`v7.0.1`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-701--2022-12-23)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.0.0...7.0.1)

- When checking if a file mapping resolved to a file that exists, we
weren't
considering files in .whl files. This is now fixed, closing `issue
1511`\_.

- File pattern rules were too strict, forbidding plus signs and curly
braces in
directory and file names. This is now fixed, closing `issue 1513`\_.

-   Unusual Unicode or control characters in source files could prevent
    reporting.  This is now fixed, closing `issue 1512`\_.

- The PyPy wheel now installs on PyPy 3.7, 3.8, and 3.9, closing `issue
1510`\_.

.. \_issue
1510:[https://github.com/nedbat/coveragepy/issues/1510](https://togithub.com/nedbat/coveragepy/issues/1510)0
.. \_issue
1511[https://github.com/nedbat/coveragepy/issues/1511](https://togithub.com/nedbat/coveragepy/issues/1511)11
.. \_issue
151[https://github.com/nedbat/coveragepy/issues/1512](https://togithub.com/nedbat/coveragepy/issues/1512)512
.. \_issue
15[https://github.com/nedbat/coveragepy/issues/1513](https://togithub.com/nedbat/coveragepy/issues/1513)1513

.. \_changes\_7-0-0:

###
[`v7.0.0`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-700--2022-12-18)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/6.5.0...7.0.0)

Nothing new beyond 7.0.0b1.

.. \_changes\_7-0-0b1:

###
[`v6.5.0`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-650--2022-09-29)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/6.4.4...6.5.0)

- The JSON report now includes details of which branches were taken, and
which
are missing for each file. Thanks, `Christoph Blessing <pull 1438_>`*.
Closes
    `issue 1425`*.

- Starting with coverage.py 6.2, `class` statements were marked as a
branch.
This wasn't right, and has been reverted, fixing `issue 1449`\_. Note
this
will very slightly reduce your coverage total if you are measuring
branch
    coverage.

-   Packaging is now compliant with `PEP 517`*, closing `issue 1395`*.

- A new debug option `--debug=pathmap` shows details of the remapping of
    paths that happens during combine due to the `[paths]` setting.

- Fix an internal problem with caching of invalid Python parsing. Found
by
    OSS-Fuzz, fixing their `bug 50381`\_.

.. \_bug 50381:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50381
.. \_PEP 517: https://peps.python.org/pep-0517/
.. \_issue
139[https://github.com/nedbat/coveragepy/issues/1395](https://togithub.com/nedbat/coveragepy/issues/1395)395
.. \_issue
14[https://github.com/nedbat/coveragepy/issues/1425](https://togithub.com/nedbat/coveragepy/issues/1425)1425
.. \_issue
1[https://github.com/nedbat/coveragepy/issues/1449](https://togithub.com/nedbat/coveragepy/issues/1449)/1449
.. \_pull
[https://github.com/nedbat/coveragepy/pull/1438](https://togithub.com/nedbat/coveragepy/pull/1438)l/1438

.. \_changes\_6-4-4:

###
[`v6.4.4`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-644--2022-08-16)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/6.4.3...6.4.4)

-   Wheels are now provided for Python 3.11.

.. \_changes\_6-4-3:

###
[`v6.4.3`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-643--2022-08-06)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/6.4.2...6.4.3)

- Fix a failure when combining data files if the file names contained
glob-like
patterns. Thanks, `Michael Krebs and Benjamin Schubert <pull 1405_>`\_.

- Fix a messaging failure when combining Windows data files on a
different
drive than the current directory, closing `issue 1428`*. Thanks,
`Lorenzo
    Micò <pull 1430_>`*.

- Fix path calculations when running in the root directory, as you might
do in
    a Docker container. Thanks `Arthur Rio <pull 1403_>`\_.

- Filtering in the HTML report wouldn't work when reloading the index
page.
    This is now fixed.  Thanks, `Marc Legendre <pull 1413_>`\_.

- Fix a problem with Cython code measurement, closing `issue 972`*.
Thanks,
    `Matus Valo <pull 1347_>`*.

.. \_issue
972:[https://github.com/nedbat/coveragepy/issues/972](https://togithub.com/nedbat/coveragepy/issues/972)2
.. \_issue
1428[https://github.com/nedbat/coveragepy/issues/1428](https://togithub.com/nedbat/coveragepy/issues/1428)28
.. \_pull
134[https://github.com/nedbat/coveragepy/pull/1347](https://togithub.com/nedbat/coveragepy/pull/1347)347
.. \_pull
14[https://github.com/nedbat/coveragepy/issues/1403](https://togithub.com/nedbat/coveragepy/issues/1403)1403
.. \_pull
1[https://github.com/nedbat/coveragepy/issues/1405](https://togithub.com/nedbat/coveragepy/issues/1405)/1405
.. \_pull
[https://github.com/nedbat/coveragepy/issues/1413](https://togithub.com/nedbat/coveragepy/issues/1413)s/1413
..
\_pull[https://github.com/nedbat/coveragepy/pull/1430](https://togithub.com/nedbat/coveragepy/pull/1430)ll/1430

.. \_changes\_6-4-2:

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/allenporter/flux-local).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMjQuMiIsInVwZGF0ZWRJblZlciI6IjM0LjEyNC4yIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue May 5, 2023
Version 7.2.5 — 2023-04-30
--------------------------

- Fix: ``html_report()`` could fail with an AttributeError on ``isatty`` if run
  in an unusual environment where sys.stdout had been replaced.  This is now
  fixed.


Version 7.2.4 — 2023-04-28
--------------------------

PyCon 2023 sprint fixes!

- Fix: with ``relative_files = true``, specifying a specific file to include or
  omit wouldn't work correctly (`issue 1604`_).  This is now fixed, with
  testing help by `Marc Gibbons <pull 1608_>`_.

- Fix: the XML report would have an incorrect ``<source>`` element when using
  relative files and the source option ended with a slash (`issue 1541`_).
  This is now fixed, thanks to `Kevin Brown-Silva <pull 1608_>`_.

- When the HTML report location is printed to the terminal, it's now a
  terminal-compatible URL, so that you can click the location to open the HTML
  file in your browser.  Finishes `issue 1523`_ thanks to `Ricardo Newbery
  <pull 1613_>`_.

- Docs: a new :ref:`Migrating page <migrating>` with details about how to
  migrate between major versions of coverage.py.  It currently covers the
  wildcard changes in 7.x.  Thanks, `Brian Grohe <pull 1610_>`_.

.. _issue 1523: nedbat/coveragepy#1523
.. _issue 1541: nedbat/coveragepy#1541
.. _issue 1604: nedbat/coveragepy#1604
.. _pull 1608: nedbat/coveragepy#1608
.. _pull 1609: nedbat/coveragepy#1609
.. _pull 1610: nedbat/coveragepy#1610
.. _pull 1613: nedbat/coveragepy#1613


Version 7.2.3 — 2023-04-06
--------------------------

- Fix: the :ref:`config_run_sigterm` setting was meant to capture data if a
  process was terminated with a SIGTERM signal, but it didn't always.  This was
  fixed thanks to `Lewis Gaul <pull 1600_>`_, closing `issue 1599`_.

- Performance: HTML reports with context information are now much more compact.
  File sizes are typically as small as one-third the previous size, but can be
  dramatically smaller. This closes `issue 1584`_ thanks to `Oleh Krehel
  <pull 1587_>`_.

- Development dependencies no longer use hashed pins, closing `issue 1592`_.

.. _issue 1584: nedbat/coveragepy#1584
.. _pull 1587: nedbat/coveragepy#1587
.. _issue 1592: nedbat/coveragepy#1592
.. _issue 1599: nedbat/coveragepy#1599
.. _pull 1600: nedbat/coveragepy#1600


Version 7.2.2 — 2023-03-16
--------------------------

- Fix: if a virtualenv was created inside a source directory, and a sourced
  package was installed inside the virtualenv, then all of the third-party
  packages inside the virtualenv would be measured.  This was incorrect, but
  has now been fixed: only the specified packages will be measured, thanks to
  `Manuel Jacob <pull 1560_>`_.

- Fix: the ``coverage lcov`` command could create a .lcov file with incorrect
  LF (lines found) and LH (lines hit) totals.  This is now fixed, thanks to
  `Ian Moore <pull 1583_>`_.

- Fix: the ``coverage xml`` command on Windows could create a .xml file with
  duplicate ``<package>`` elements. This is now fixed, thanks to `Benjamin
  Parzella <pull 1574_>`_, closing `issue 1573`_.

.. _pull 1560: nedbat/coveragepy#1560
.. _issue 1573: nedbat/coveragepy#1573
.. _pull 1574: nedbat/coveragepy#1574
.. _pull 1583: nedbat/coveragepy#1583


Version 7.2.1 — 2023-02-26
--------------------------

- Fix: the PyPI page had broken links to documentation pages, but no longer
  does, closing `issue 1566`_.

- Fix: public members of the coverage module are now properly indicated so that
  mypy will find them, fixing `issue 1564`_.

.. _issue 1564: nedbat/coveragepy#1564
.. _issue 1566: nedbat/coveragepy#1566


Version 7.2.0 — 2023-02-22
--------------------------

- Added a new setting ``[report] exclude_also`` to let you add more exclusions
  without overwriting the defaults.  Thanks, `Alpha Chen <pull 1557_>`_,
  closing `issue 1391`_.

- Added a :meth:`.CoverageData.purge_files` method to remove recorded data for
  a particular file.  Contributed by `Stephan Deibel <pull 1547_>`_.

- Fix: when reporting commands fail, they will no longer congratulate
  themselves with messages like "Wrote XML report to file.xml" before spewing a
  traceback about their failure.

- Fix: arguments in the public API that name file paths now accept pathlib.Path
  objects.  This includes the ``data_file`` and ``config_file`` arguments to
  the Coverage constructor and the ``basename`` argument to CoverageData.
  Closes `issue 1552`_.

- Fix: In some embedded environments, an IndexError could occur on stop() when
  the originating thread exits before completion.  This is now fixed, thanks to
  `Russell Keith-Magee <pull 1543_>`_, closing `issue 1542`_.

- Added a ``py.typed`` file to announce our type-hintedness.  Thanks,
  `KotlinIsland <pull 1550_>`_.

.. _issue 1391: nedbat/coveragepy#1391
.. _issue 1542: nedbat/coveragepy#1542
.. _pull 1543: nedbat/coveragepy#1543
.. _pull 1547: nedbat/coveragepy#1547
.. _pull 1550: nedbat/coveragepy#1550
.. _issue 1552: nedbat/coveragepy#1552
.. _pull 1557: nedbat/coveragepy#1557


Version 7.1.0 — 2023-01-24
--------------------------

- Added: the debug output file can now be specified with ``[run] debug_file``
  in the configuration file.  Closes `issue 1319`_.

- Performance: fixed a slowdown with dynamic contexts that's been around since
  6.4.3.  The fix closes `issue 1538`_.  Thankfully this doesn't break the
  `Cython change`_ that fixed `issue 972`_.  Thanks to Mathieu Kniewallner for
  the deep investigative work and comprehensive issue report.

- Typing: all product and test code has type annotations.

.. _Cython change: nedbat/coveragepy#1347
.. _issue 972: nedbat/coveragepy#972
.. _issue 1319: nedbat/coveragepy#1319
.. _issue 1538: nedbat/coveragepy#1538

Version 7.0.5 — 2023-01-10
--------------------------

- Fix: On Python 3.7, a file with type annotations but no ``from __future__
  import annotations`` would be missing statements in the coverage report. This
  is now fixed, closing `issue 1524`_.

.. _issue 1524: nedbat/coveragepy#1524


Version 7.0.4 — 2023-01-07
--------------------------

- Performance: an internal cache of file names was accidentally disabled,
  resulting in sometimes drastic reductions in performance.  This is now fixed,
  closing `issue 1527`_.   Thanks to Ivan Ciuvalschii for the reproducible test
  case.

.. _issue 1527: nedbat/coveragepy#1527


Version 7.0.3 — 2023-01-03
--------------------------

- Fix: when using pytest-cov or pytest-xdist, or perhaps both, the combining
  step could fail with ``assert row is not None`` using 7.0.2.  This was due to
  a race condition that has always been possible and is still possible. In
  7.0.1 and before, the error was silently swallowed by the combining code.
  Now it will produce a message "Couldn't combine data file" and ignore the
  data file as it used to do before 7.0.2.  Closes `issue 1522`_.

.. _issue 1522: nedbat/coveragepy#1522


Version 7.0.2 — 2023-01-02
--------------------------

- Fix: when using the ``[run] relative_files = True`` setting, a relative
  ``[paths]`` pattern was still being made absolute.  This is now fixed,
  closing `issue 1519`_.

- Fix: if Python doesn't provide tomllib, then TOML configuration files can
  only be read if coverage.py is installed with the ``[toml]`` extra.
  Coverage.py will raise an error if TOML support is not installed when it sees
  your settings are in a .toml file. But it didn't understand that
  ``[tools.coverage]`` was a valid section header, so the error wasn't reported
  if you used that header, and settings were silently ignored.  This is now
  fixed, closing `issue 1516`_.

- Fix: adjusted how decorators are traced on PyPy 7.3.10, fixing `issue 1515`_.

- Fix: the ``coverage lcov`` report did not properly implement the
  ``--fail-under=MIN`` option.  This has been fixed.

- Refactor: added many type annotations, including a number of refactorings.
  This should not affect outward behavior, but they were a bit invasive in some
  places, so keep your eyes peeled for oddities.

- Refactor: removed the vestigial and long untested support for Jython and
  IronPython.

.. _issue 1515: nedbat/coveragepy#1515
.. _issue 1516: nedbat/coveragepy#1516
.. _issue 1519: nedbat/coveragepy#1519


Version 7.0.1 — 2022-12-23
--------------------------

- When checking if a file mapping resolved to a file that exists, we weren't
  considering files in .whl files.  This is now fixed, closing `issue 1511`_.

- File pattern rules were too strict, forbidding plus signs and curly braces in
  directory and file names.  This is now fixed, closing `issue 1513`_.

- Unusual Unicode or control characters in source files could prevent
  reporting.  This is now fixed, closing `issue 1512`_.

- The PyPy wheel now installs on PyPy 3.7, 3.8, and 3.9, closing `issue 1510`_.

.. _issue 1510: nedbat/coveragepy#1510
.. _issue 1511: nedbat/coveragepy#1511
.. _issue 1512: nedbat/coveragepy#1512
.. _issue 1513: nedbat/coveragepy#1513


Version 7.0.0 — 2022-12-18
--------------------------

Nothing new beyond 7.0.0b1.


Version 7.0.0b1 — 2022-12-03
----------------------------

A number of changes have been made to file path handling, including pattern
matching and path remapping with the ``[paths]`` setting (see
:ref:`config_paths`).  These changes might affect you, and require you to
update your settings.

(This release includes the changes from `6.6.0b1 <changes_6-6-0b1_>`_, since
6.6.0 was never released.)

- Changes to file pattern matching, which might require updating your
  configuration:

  - Previously, ``*`` would incorrectly match directory separators, making
    precise matching difficult.  This is now fixed, closing `issue 1407`_.

  - Now ``**`` matches any number of nested directories, including none.

- Improvements to combining data files when using the
  :ref:`config_run_relative_files` setting, which might require updating your
  configuration:

  - During ``coverage combine``, relative file paths are implicitly combined
    without needing a ``[paths]`` configuration setting.  This also fixed
    `issue 991`_.

  - A ``[paths]`` setting like ``*/foo`` will now match ``foo/bar.py`` so that
    relative file paths can be combined more easily.

  - The :ref:`config_run_relative_files` setting is properly interpreted in
    more places, fixing `issue 1280`_.

- When remapping file paths with ``[paths]``, a path will be remapped only if
  the resulting path exists.  The documentation has long said the prefix had to
  exist, but it was never enforced.  This fixes `issue 608`_, improves `issue
  649`_, and closes `issue 757`_.

- Reporting operations now implicitly use the ``[paths]`` setting to remap file
  paths within a single data file.  Combining multiple files still requires the
  ``coverage combine`` step, but this simplifies some single-file situations.
  Closes `issue 1212`_ and `issue 713`_.

- The ``coverage report`` command now has a ``--format=`` option.  The original
  style is now ``--format=text``, and is the default.

  - Using ``--format=markdown`` will write the table in Markdown format, thanks
    to `Steve Oswald <pull 1479_>`_, closing `issue 1418`_.

  - Using ``--format=total`` will write a single total number to the
    output.  This can be useful for making badges or writing status updates.

- Combining data files with ``coverage combine`` now hashes the data files to
  skip files that add no new information.  This can reduce the time needed.
  Many details affect the speed-up, but for coverage.py's own test suite,
  combining is about 40% faster. Closes `issue 1483`_.

- When searching for completely un-executed files, coverage.py uses the
  presence of ``__init__.py`` files to determine which directories have source
  that could have been imported.  However, `implicit namespace packages`_ don't
  require ``__init__.py``.  A new setting ``[report]
  include_namespace_packages`` tells coverage.py to consider these directories
  during reporting.  Thanks to `Felix Horvat <pull 1387_>`_ for the
  contribution.  Closes `issue 1383`_ and `issue 1024`_.

- Fixed environment variable expansion in pyproject.toml files.  It was overly
  broad, causing errors outside of coverage.py settings, as described in `issue
  1481`_ and `issue 1345`_.  This is now fixed, but in rare cases will require
  changing your pyproject.toml to quote non-string values that use environment
  substitution.

- An empty file has a coverage total of 100%, but used to fail with
  ``--fail-under``.  This has been fixed, closing `issue 1470`_.

- The text report table no longer writes out two separator lines if there are
  no files listed in the table.  One is plenty.

- Fixed a mis-measurement of a strange use of wildcard alternatives in
  match/case statements, closing `issue 1421`_.

- Fixed internal logic that prevented coverage.py from running on
  implementations other than CPython or PyPy (`issue 1474`_).

- The deprecated ``[run] note`` setting has been completely removed.

.. _implicit namespace packages: https://peps.python.org/pep-0420/
.. _issue 608: nedbat/coveragepy#608
.. _issue 649: nedbat/coveragepy#649
.. _issue 713: nedbat/coveragepy#713
.. _issue 757: nedbat/coveragepy#757
.. _issue 991: nedbat/coveragepy#991
.. _issue 1024: nedbat/coveragepy#1024
.. _issue 1212: nedbat/coveragepy#1212
.. _issue 1280: nedbat/coveragepy#1280
.. _issue 1345: nedbat/coveragepy#1345
.. _issue 1383: nedbat/coveragepy#1383
.. _issue 1407: nedbat/coveragepy#1407
.. _issue 1418: nedbat/coveragepy#1418
.. _issue 1421: nedbat/coveragepy#1421
.. _issue 1470: nedbat/coveragepy#1470
.. _issue 1474: nedbat/coveragepy#1474
.. _issue 1481: nedbat/coveragepy#1481
.. _issue 1483: nedbat/coveragepy#1483
.. _pull 1387: nedbat/coveragepy#1387
.. _pull 1479: nedbat/coveragepy#1479



Version 6.6.0b1 — 2022-10-31
----------------------------

(Note: 6.6.0 final was never released. These changes are part of `7.0.0b1
<changes_7-0-0b1_>`_.)

- Changes to file pattern matching, which might require updating your
  configuration:

  - Previously, ``*`` would incorrectly match directory separators, making
    precise matching difficult.  This is now fixed, closing `issue 1407`_.

  - Now ``**`` matches any number of nested directories, including none.

- Improvements to combining data files when using the
  :ref:`config_run_relative_files` setting:

  - During ``coverage combine``, relative file paths are implicitly combined
    without needing a ``[paths]`` configuration setting.  This also fixed
    `issue 991`_.

  - A ``[paths]`` setting like ``*/foo`` will now match ``foo/bar.py`` so that
    relative file paths can be combined more easily.

  - The setting is properly interpreted in more places, fixing `issue 1280`_.

- Fixed environment variable expansion in pyproject.toml files.  It was overly
  broad, causing errors outside of coverage.py settings, as described in `issue
  1481`_ and `issue 1345`_.  This is now fixed, but in rare cases will require
  changing your pyproject.toml to quote non-string values that use environment
  substitution.

- Fixed internal logic that prevented coverage.py from running on
  implementations other than CPython or PyPy (`issue 1474`_).

.. _issue 991: nedbat/coveragepy#991
.. _issue 1280: nedbat/coveragepy#1280
.. _issue 1345: nedbat/coveragepy#1345
.. _issue 1407: nedbat/coveragepy#1407
.. _issue 1474: nedbat/coveragepy#1474
.. _issue 1481: nedbat/coveragepy#1481
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

3 participants