Skip to content

Conversation

dmontagu
Copy link
Contributor

@dmontagu dmontagu commented Oct 7, 2019

Change Summary

Adds if TYPE_CHECKING: to the exclude_lines for coverage so that the # pragma: no cover can be removed everywhere it occurs next to an if TYPE_CHECKING: block.

Note: this is safe since code inside such blocks should never be executed except during static analysis.

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.rst file added describing change
    (see changes/README.md for details)

@dmontagu
Copy link
Contributor Author

dmontagu commented Oct 7, 2019

I noticed this while working on #873, but assumed it would be better to put it in a separate PR.

@codecov
Copy link

codecov bot commented Oct 7, 2019

Codecov Report

Merging #874 into master will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff          @@
##           master   #874   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          16     16           
  Lines        2716   2716           
  Branches      518    518           
=====================================
  Hits         2716   2716
Impacted Files Coverage Δ
pydantic/color.py 100% <ø> (ø) ⬆️
pydantic/types.py 100% <ø> (ø) ⬆️
pydantic/dataclasses.py 100% <ø> (ø) ⬆️
pydantic/fields.py 100% <ø> (ø) ⬆️
pydantic/schema.py 100% <ø> (ø) ⬆️
pydantic/class_validators.py 100% <ø> (ø) ⬆️
pydantic/typing.py 100% <ø> (ø) ⬆️
pydantic/utils.py 100% <ø> (ø) ⬆️
pydantic/networks.py 100% <ø> (ø) ⬆️
pydantic/validators.py 100% <ø> (ø) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33b7d52...aeb539e. Read the comment docs.

@samuelcolvin
Copy link
Member

👍 very clever/how was I too stupid to think of this before?

@dmontagu dmontagu mentioned this pull request Oct 7, 2019
4 tasks
@samuelcolvin samuelcolvin merged commit 425fac6 into pydantic:master Oct 7, 2019
andreshndz pushed a commit to cuenca-mx/pydantic that referenced this pull request Jan 17, 2020
* Automatically add no-cover to TYPE_CHECKING blocks

* Add changes file
alexdrydew pushed a commit to alexdrydew/pydantic that referenced this pull request Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants