Skip to content

Strict typing #1046

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

Merged
merged 34 commits into from
Feb 28, 2025
Merged

Strict typing #1046

merged 34 commits into from
Feb 28, 2025

Conversation

Dreamsorcerer
Copy link
Member

@Dreamsorcerer Dreamsorcerer commented Feb 18, 2025

No description provided.

Copy link
Contributor

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link

codspeed-hq bot commented Feb 18, 2025

CodSpeed Performance Report

Merging #1046 will improve performances by 12.56%

Comparing strict-typing (611c704) with master (531aadf)

Summary

⚡ 1 improvements
✅ 37 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
test_cimultidict_extend_istr 142.9 µs 127 µs +12.56%

Copy link

codecov bot commented Feb 19, 2025

Codecov Report

Attention: Patch coverage is 92.73743% with 26 lines in your changes missing coverage. Please review.

Project coverage is 97.53%. Comparing base (531aadf) to head (611c704).
Report is 99 commits behind head on master.

Files with missing lines Patch % Lines
multidict/_abc.py 69.23% 0 Missing and 12 partials ⚠️
multidict/_multidict_py.py 91.17% 0 Missing and 12 partials ⚠️
docs/conf.py 0.00% 1 Missing ⚠️
multidict/__init__.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1046      +/-   ##
==========================================
+ Coverage   94.87%   97.53%   +2.66%     
==========================================
  Files          23       22       -1     
  Lines        2671     2597      -74     
  Branches      250      376     +126     
==========================================
- Hits         2534     2533       -1     
+ Misses         67       36      -31     
+ Partials       70       28      -42     
Flag Coverage Δ
CI-GHA 97.53% <92.73%> (+2.66%) ⬆️
MyPy 86.53% <66.19%> (+16.04%) ⬆️
pytest 98.18% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Dreamsorcerer Dreamsorcerer marked this pull request as ready for review February 19, 2025 16:03
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Feb 19, 2025
@Dreamsorcerer Dreamsorcerer merged commit fe4dee0 into master Feb 28, 2025
44 of 47 checks passed
@Dreamsorcerer Dreamsorcerer deleted the strict-typing branch February 28, 2025 14:59
@@ -11,8 +11,10 @@ _site-packages-to-src-mapping =

[report]
exclude_also =
pass
^\s*@pytest\.mark\.xfail
Copy link
Member

Choose a reason for hiding this comment

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

@Dreamsorcerer why did you drop this one?

Copy link
Member Author

@Dreamsorcerer Dreamsorcerer Feb 28, 2025

Choose a reason for hiding this comment

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

We've seen cases on aiohttp in the past where an xfail test wasn't running at all and codecov highlighted the mistake. A change in coverage for an xfail test in a PR may also indicate a mistake (whether in the test or the PR changes).

Copy link
Member

Choose a reason for hiding this comment

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

@Dreamsorcerer those cases in aiohttp weren't because of the marker. But because of the test names being borked. This exclusion brings stability to the coverage metrics.

Copy link
Member Author

Choose a reason for hiding this comment

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

But because of the test names being borked.

But, coverage is what finds the issue and allows us to fix it. With no coverage on decorated functions, we have no way to detect those issues currently.

This exclusion brings stability to the coverage metrics.

xfail tests should still have stable coverage, otherwise those tests are probably written incorrectly, just as they should have stable results (otherwise xfail strict would fail our CI).

Copy link
Member

Choose a reason for hiding this comment

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

@Dreamsorcerer

But because of the test names being borked.

But, coverage is what finds the issue and allows us to fix it. With no coverage on decorated functions, we have no way to detect those issues currently.

It does and it finds. Just not in the things decorated with xfail marker. It's a special case that we shouldn't rely on to create incidental coverage in other places.

This exclusion brings stability to the coverage metrics.

xfail tests should still have stable coverage, otherwise those tests are probably written incorrectly, just as they should have stable results (otherwise xfail strict would fail our CI).

A portion of xfail would be flaky, interrupting the test functions at random places inside. So different number of lines would be covered.
And the rest of invocations might create stable coverage with like half of lines being red in such test functions. And this is bad because it prevents us from having a stable requirement of 100% on the tests dir.

@Dreamsorcerer
Copy link
Member Author

It may be a good idea to do a beta release and test out the new typing on aiohttp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants