Skip to content

Conversation

@youtux
Copy link
Contributor

@youtux youtux commented Jun 28, 2025

No description provided.

@youtux youtux requested a review from Copilot June 28, 2025 05:59
Copy link

Copilot AI left a 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
Copy link

Copilot AI Jun 28, 2025

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.

Suggested change
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)):

Copilot uses AI. Check for mistakes.
@youtux youtux enabled auto-merge June 28, 2025 06:00
@codecov
Copy link

codecov bot commented Jun 28, 2025

Codecov Report

Attention: Patch coverage is 94.33962% with 3 lines in your changes missing coverage. Please review.

Project coverage is 97.79%. Comparing base (8a52ff3) to head (83b9ac3).

Files with missing lines Patch % Lines
pytest_factoryboy/fixture.py 94.73% 0 Missing and 2 partials ⚠️
pytest_factoryboy/compat.py 0.00% 1 Missing ⚠️
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.
📢 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.

@youtux youtux disabled auto-merge June 28, 2025 11:23
@youtux youtux merged commit 8ccbda4 into master Jun 28, 2025
17 checks passed
@youtux youtux deleted the fix-type-annotations branch June 28, 2025 11:23
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.

2 participants