Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-37955: mock.patch incorrect reference to Mock#15521

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@phsilva
Copy link
Contributor

@phsilvaphsilva commentedAug 26, 2019
edited by bedevere-bot
Loading

mock.patch mentions that keyword arguments are passed
to Mock when it passes to MagicMock by default.

This PR fixes that.

https://bugs.python.org/issue37955

@the-knights-who-say-ni

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed thePSF contributor agreement (CLA).

Our records indicate we have not received your CLA. For legal reasons we need you to sign this before we can look at your contribution. Please followthe steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You cancheck yourself to see if the CLA has been received.

Thanks again for your contribution, we look forward to reviewing it!

@bedevere-botbedevere-bot added docsDocumentation in the Doc dir awaiting review labelsAug 26, 2019
@tirkarthi
Copy link
Member

Changing the hyperlink toMock sounds good to me. But also note like#13681 from 3.8 the default value could beMagicMock orAsyncMock depends on the target. cc:@mariocj89@cjw296

mock.patch mentions that keyword arguments are passedto Mock when it passes to MagicMock by default.This PR fixes that.
@phsilvaphsilvaforce-pushed thebpo-37955-incorrect-reference-in-mock-patch-doc branch from6c0f647 to6578726CompareAugust 26, 2019 16:08
@phsilva
Copy link
ContributorAuthor

Changing the hyperlink toMock sounds good to me. But also note like#13681 from 3.8 the default value could beMagicMock orAsyncMock depends on the target. cc:@mariocj89@cjw296

The issue on#13681 seems important, the return value on those functions is mostly undocumented right now (since 3.8 changes).

Maybe we should stop mentioning what the actual return type is and say it is whatever is on new_callable and at new_callable we can mention that it depends based on async or not.

This patch adds information about possible use of a AsyncMockwhen passing arbitrary arguments to mock.patch.
@phsilva
Copy link
ContributorAuthor

Latest patch adjust the text to account the suggestions. Appreciate any reviews.

`patch` takes arbitrary keyword arguments. These will be passed to
the `Mock` (or `new_callable`) on construction.
to construct a `AsyncMock` if the patched object is an async function,
to `MagicMock` otherwise or to `new_callable` if specified.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any way we could not have this text duplicated between mock.py and mock.rst?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I am new to Python docs, but as far as I looked around there is a lot of duplication between .rst and .py in many modules, will need to ask around about if there is another way.

Copy link
Contributor

Choose a reason for hiding this comment

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

It makes this a more substantial PR, but Sphinx autodoc should be able to pull in the .py's docstrings. Not sure if autodoc is enabled for the CPython docs, that would be some more digging on your part :-)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Will take a look into it, but it looks like all modules actually repeats docs inDoc and inLib, will ask around why.

Copy link
Contributor

Choose a reason for hiding this comment

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

How did the asking around go?

@bedevere-bot
Copy link

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 phraseI 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.

@phsilva
Copy link
ContributorAuthor

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

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

@phsilva
Copy link
ContributorAuthor

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

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

@phsilva
Copy link
ContributorAuthor

Hi, would be great if can get some review here... Thanks a lot!@lisroach@cjw296

@csabellacsabella requested review fromcjw296,lisroach andtirkarthi and removed request forcjw296 andlisroachJanuary 21, 2020 12:23
@cjw296
Copy link
Contributor

@csabella: waiting for a response to#15521 (comment)

Copy link
Contributor

@cjw296cjw296 left a comment

Choose a reason for hiding this comment

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

Actually, let's leave the bigger change for another time.

@csabella
Copy link
Contributor

Thanks!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@cjw296cjw296cjw296 approved these changes

@lisroachlisroachAwaiting requested review from lisroach

@tirkarthitirkarthiAwaiting requested review from tirkarthi

Assignees

No one assigned

Labels

docsDocumentation in the Doc dirskip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@phsilva@the-knights-who-say-ni@tirkarthi@bedevere-bot@cjw296@csabella@lisroach

[8]ページ先頭

©2009-2025 Movatter.jp