Skip to content

bpo-24758: Improve the error msg for unittest.mock.Mock()'s unsafe mode#12991

Merged
kushaldas merged 3 commits into
python:masterfrom
ZackerySpytz:bpo-24758-error-msg-Mock-unsafe
May 8, 2019
Merged

bpo-24758: Improve the error msg for unittest.mock.Mock()'s unsafe mode#12991
kushaldas merged 3 commits into
python:masterfrom
ZackerySpytz:bpo-24758-error-msg-Mock-unsafe

Conversation

@ZackerySpytz
Copy link
Copy Markdown
Contributor

@ZackerySpytz ZackerySpytz commented Apr 28, 2019

Comment thread Lib/unittest/mock.py Outdated
Copy link
Copy Markdown
Member

@kushaldas kushaldas left a comment

Choose a reason for hiding this comment

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

"Attributes cannot start with 'assert' or 'assret'" is a better error message in this. Also, please check for the right error message in test_mock_unsafe as we are checking the assertion there.

@bedevere-bot
Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ZackerySpytz
Copy link
Copy Markdown
Contributor Author

Thank you, @kushaldas.

I have made the requested changes; please review again.

@bedevere-bot
Copy link
Copy Markdown

Thanks for making the requested changes!

@kushaldas: please review the changes made to this pull request.

Copy link
Copy Markdown
Member

@tirkarthi tirkarthi left a comment

Choose a reason for hiding this comment

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

LGTM. The attribute can start with assert or assret in unsafe mode but adding it to error message looks intrusive to me and this seems like a good improvement.

Thank you for the PR.

Copy link
Copy Markdown
Member

@kushaldas kushaldas left a comment

Choose a reason for hiding this comment

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

This looks good now, thank you for the PR. Approved.

@kushaldas kushaldas merged commit b9b08cd into python:master May 8, 2019
@bedevere-bot
Copy link
Copy Markdown

@kushaldas: Please replace # with GH- in the commit message next time. Thanks!

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.

5 participants