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

Automatically add no-cover to TYPE_CHECKING blocks #874

Merged
merged 2 commits into from Oct 7, 2019

Conversation

dmontagu
Copy link
Collaborator

@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
Collaborator Author

@dmontagu 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 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
Owner

@samuelcolvin samuelcolvin commented Oct 7, 2019

👍 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 samuelcolvin:master Oct 7, 2019
10 checks passed
andreshndz pushed a commit to cuenca-mx/pydantic that referenced this issue Jan 17, 2020
* Automatically add no-cover to TYPE_CHECKING blocks

* Add changes file
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.

None yet

2 participants