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

Fix typing and update to mypy 1.8.0 #769

Merged
merged 5 commits into from
Feb 6, 2024
Merged

Conversation

bluetech
Copy link
Member

When reading the code I noticed the line _event_loop_fixture_id = StashKey[str] which should be _event_loop_fixture_id = StashKey[str]() (an instance). I wondered how come mypy didn't complain, and the reason is that pytest wasn't installed in the pre-commit mypy environment.

This PR:

  • Adds the missing pytest dep
  • Fixes the resulting typing errors
  • Upgrades mypy to the latest version
  • Fixes mypy tests/ by makes tests/ a package (adding __init__.py files)

pytest_asyncio/plugin.py Show resolved Hide resolved
pytest_asyncio/plugin.py Outdated Show resolved Hide resolved
pytest_asyncio/plugin.py Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e92efad) 94.33% compared to head (a53f378) 94.35%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #769      +/-   ##
==========================================
+ Coverage   94.33%   94.35%   +0.01%     
==========================================
  Files           2        2              
  Lines         477      478       +1     
  Branches       95       96       +1     
==========================================
+ Hits          450      451       +1     
  Misses         17       17              
  Partials       10       10              

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

@seifertm seifertm linked an issue Feb 6, 2024 that may be closed by this pull request
Copy link
Contributor

@seifertm seifertm left a comment

Choose a reason for hiding this comment

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

This is great! Thank you for the patch.

I'll rebase and add a changelog entry, so we can get this out in a pre-release right away.

pytest_asyncio/plugin.py Show resolved Hide resolved
pytest_asyncio/plugin.py Outdated Show resolved Hide resolved
bluetech and others added 5 commits February 6, 2024 20:13
This allows mypy to distinguish between the different conftests.py files
when running `mypy tests/`, and it's also preferable in general.
Signed-off-by: Michael Seifert <[email protected]>
@seifertm seifertm added this to the v0.23 milestone Feb 6, 2024
@seifertm seifertm added this pull request to the merge queue Feb 6, 2024
@seifertm seifertm removed this pull request from the merge queue due to a manual request Feb 6, 2024
@seifertm seifertm merged commit fc6d6cf into pytest-dev:main Feb 6, 2024
14 checks passed
@bluetech bluetech deleted the update-mypy branch February 6, 2024 19:27
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.

Update mypy pre-commit hook
3 participants