-
Notifications
You must be signed in to change notification settings - Fork 42
Fix type annotations #245
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 type annotations #245
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR aims to improve and correct type annotations across the codebase for pytest-factoryboy while aligning with updated Python typing standards.
- Update tox.ini to change the default mypy positional argument.
- Revise type annotations in plugin.py, fixture.py, and compat.py to use generic types appropriately.
- Modify pyproject.toml to relax the untyped call restrictions in mypy.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tox.ini | Changed default posargs for mypy commands. |
| pytest_factoryboy/plugin.py | Updated type annotations on DeferredFunction and related API calls along with minor refactoring. |
| pytest_factoryboy/fixture.py | Revised type annotations and generics throughout, including renaming temporary factories. |
| pytest_factoryboy/compat.py | Enhanced function type signatures with updated type ignore directives. |
| pyproject.toml | Adjusted mypy configuration by changing disallow_untyped_calls to false. |
Comments suppressed due to low confidence (1)
tox.ini:31
- The default posargs value was changed from '.' to 'pytest_factoryboy'. Please verify that this change is intentional and that it aligns with the desired mypy execution behavior.
commands = mypy {posargs:pytest_factoryboy}
| # once we are able to evaluate all the related fixtures. | ||
| with disable_method(Factory._after_postgeneration): | ||
| instance = Factory(**kwargs) | ||
| with disable_method(NewFactory._after_postgeneration): # type: ignore[arg-type] # https://github.com/python/mypy/issues/14235 |
Copilot
AI
Jun 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider revisiting the use of the type ignore comment here; if possible, update the type annotations to resolve the underlying type issue instead of suppressing it.
| with disable_method(NewFactory._after_postgeneration): # type: ignore[arg-type] # https://github.com/python/mypy/issues/14235 | |
| with disable_method(cast(Callable[..., Any], NewFactory._after_postgeneration)): |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #245 +/- ##
==========================================
+ Coverage 97.76% 97.79% +0.02%
==========================================
Files 14 14
Lines 852 861 +9
Branches 51 52 +1
==========================================
+ Hits 833 842 +9
Misses 8 8
Partials 11 11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.