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

feat(tests): Do not include type checking code in coverage report #3327

Merged
merged 7 commits into from
Jul 23, 2024

Conversation

antonpirker
Copy link
Member

This should not count lines (or rather if blocks) that start with if TYPE_CHECKING in the code coverage report, because this code is only evaluated when checking types with mypy.

@antonpirker antonpirker changed the title Do not type checking code in coverage report feat(tests): Do not type checking code in coverage report Jul 23, 2024
@antonpirker antonpirker changed the title feat(tests): Do not type checking code in coverage report feat(tests): Do not include type checking code in coverage report Jul 23, 2024
Copy link

codecov bot commented Jul 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.75%. Comparing base (25de71e) to head (27116d3).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3327      +/-   ##
==========================================
+ Coverage   79.49%   79.75%   +0.25%     
==========================================
  Files         133      133              
  Lines       14307    14285      -22     
  Branches     3009     3001       -8     
==========================================
+ Hits        11374    11393      +19     
+ Misses       2089     2070      -19     
+ Partials      844      822      -22     

see 26 files with indirect coverage changes

@antonpirker antonpirker marked this pull request as ready for review July 23, 2024 14:35
Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Didn't know this was possible.

.github/workflows/test-integrations-ai.yml Show resolved Hide resolved
[tool.coverage.report]
exclude_also = [
"if TYPE_CHECKING:",
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add newline at the end of the file here

Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this change, I hope it helps us get more accurate coverage reports!

@antonpirker antonpirker merged commit 0812858 into master Jul 23, 2024
123 checks passed
@antonpirker antonpirker deleted the antonpirker/dont-count-types-in-coverage branch July 23, 2024 14:55
arjennienhuis pushed a commit to arjennienhuis/sentry-python that referenced this pull request Sep 30, 2024
…tsentry#3327)

This should not count lines (or rather if blocks) that start with if TYPE_CHECKING in the code coverage report, because this code is only evaluated when checking types with mypy.
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.

3 participants