Skip to content

[stdlib][unittest] Fix mock.call(...) types #4374

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

Merged
merged 3 commits into from
Jul 30, 2020
Merged

Conversation

jermenkoo
Copy link
Contributor

#3846 defined _Call and call from unittest.mock, however the exported types are not correct; as:

These 2 make pyre trip, making code such as m = Mock(), m.assert_has_calls([<call_list_here>]) not compatible as call list will be refined as Any as opposed to _Call.

@jermenkoo
Copy link
Contributor Author

stubtest failure seems unrelated and Travis CI fails with pytype issue I have no idea how to resolve, as forward refs should be supported just fine

@srittau
Copy link
Collaborator

srittau commented Jul 30, 2020

@jermenkoo You can merge current HEAD to fix the stubtest problem. I think pytype doesn't like the quoted forward reference. It's also not necessary in stubs, so just removing the quotes should fix the problem.

@jermenkoo
Copy link
Contributor Author

Thanks! TIL stubs work fine even without the quoted forward references :)

@srittau srittau merged commit c96b1ae into python:master Jul 30, 2020
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