Skip to content

Fix type compatibility for frame locals in Python 3.15+ - #282

Merged
youtux merged 2 commits into
masterfrom
fix-mypy-py315
Oct 11, 2026
Merged

youtux merged 2 commits into
masterfrom
fix-mypy-py315

Conversation

@youtux

@youtux youtux commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI balanced review requested due to automatic review settings October 11, 2026 13:39
@youtux
youtux enabled auto-merge October 11, 2026 13:40
@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.84%. Comparing base (2eb0704) to head (72d4ada).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #282   +/-   ##
=======================================
  Coverage   97.84%   97.84%           
=======================================
  Files          17       17           
  Lines         927      927           
  Branches       55       55           
=======================================
  Hits          907      907           
  Misses          9        9           
  Partials       11       11           

☔ View full report in Codecov by Harness.
📢 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The cast exposes a proxy object as a concrete dict, creating an inaccurate API contract.

1 open finding
What changed in this PR

Updates frame-local typing for Python 3.15 compatibility.

Changes:

  • Casts frame.f_locals to the existing return type.
  • Documents the Python 3.15 typing change.
File Description
src/​pytest_factoryboy/​fixture.py Adjusts frame-local typing.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/pytest_factoryboy/fixture.py Outdated
frame.f_locals returns a FrameLocalsProxyType in Python 3.15+, which is
not a dict subclass. Annotate get_caller_locals and the _caller_locals /
inject_into_caller plumbing as MutableMapping to reflect the actual
interface used, rather than asserting a concrete dict.

Addresses review comment in #282.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The typing change accurately reflects writable frame-local proxies while preserving existing behavior.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@youtux
youtux merged commit a8fed99 into master Oct 11, 2026
21 checks passed
@youtux
youtux deleted the fix-mypy-py315 branch October 11, 2026 14:07
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