Skip to content

impl string check for patch #2313#2333

Open
asukaminato0721 wants to merge 5 commits into
facebook:mainfrom
asukaminato0721:2313
Open

impl string check for patch #2313#2333
asukaminato0721 wants to merge 5 commits into
facebook:mainfrom
asukaminato0721:2313

Conversation

@asukaminato0721
Copy link
Copy Markdown
Contributor

@asukaminato0721 asukaminato0721 commented Feb 6, 2026

Summary

Fixes part of #2313

Added a call-time check when the callee is unittest.mock.patch (detected via the _patcher instance type):

finds the longest importable module prefix

resolves the remaining components as attributes

emits the usual missing import / missing attribute errors at the string literal location

Test Plan

Added an integration test covering the missing-attribute case: with patch("main.foo") now reports

No attribute \fooin modulemain``

@meta-cla meta-cla Bot added the cla signed label Feb 6, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions github-actions Bot added size/m and removed size/m labels May 16, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions github-actions Bot added size/l and removed size/m labels May 31, 2026
@github-actions
Copy link
Copy Markdown

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@asukaminato0721 asukaminato0721 marked this pull request as ready for review May 31, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant