Skip to content
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

Improve test coverage for AsyncMock. #17906

Merged
merged 1 commit into from Jan 15, 2020
Merged

Conversation

@tirkarthi
Copy link
Member

tirkarthi commented Jan 8, 2020

  • Add test for nested async decorator patch asserting for the order of arguments supplied to function.
  • Add test for side_effect and wraps with a function to AsyncMock.
  • Add test for side_effect with an exception in the iterable to AsyncMock.

Test added with report from https://codecov.io/gh/python/cpython/src/ec0496240aaadfd4d75a80bfffdbb94fa385b7ab/Lib/unittest/mock.py

* Add test for nested async decorator patch.
* Add test for side_effect and wraps with a function.
* Add test for side_effect with an exception in the iterable.
@tirkarthi

This comment has been minimized.

Copy link
Member Author

tirkarthi commented Jan 8, 2020

FWIW, with the PR the coverage increases from 98.51% to 99.22% : https://codecov.io/gh/python/cpython/src/bfaaed1587756b32b8c7d04f3ad197ee4b3ef51c/Lib/unittest/mock.py

@tirkarthi tirkarthi mentioned this pull request Jan 13, 2020
@cjw296 cjw296 merged commit 54f743e into python:master Jan 15, 2020
8 checks passed
8 checks passed
Windows (x86)
Details
Windows (x64)
Details
macOS
Details
Ubuntu
Details
Azure Pipelines PR #20200108.19 succeeded
Details
bedevere/issue-number Issue report skipped
bedevere/news "skip news" label found
continuous-integration/travis-ci/pr The Travis CI build passed
Details
petdance added a commit to petdance/cpython that referenced this pull request Jan 17, 2020
* Add test for nested async decorator patch.
* Add test for side_effect and wraps with a function.
* Add test for side_effect with an exception in the iterable.
petdance added a commit to petdance/cpython that referenced this pull request Jan 17, 2020
* Add test for nested async decorator patch.
* Add test for side_effect and wraps with a function.
* Add test for side_effect with an exception in the iterable.
petdance added a commit to petdance/cpython that referenced this pull request Jan 17, 2020
* Add test for nested async decorator patch.
* Add test for side_effect and wraps with a function.
* Add test for side_effect with an exception in the iterable.
@miss-islington

This comment has been minimized.

Copy link

miss-islington commented Jan 24, 2020

Thanks @tirkarthi for the PR, and @cjw296 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒🤖

miss-islington added a commit to miss-islington/cpython that referenced this pull request Jan 24, 2020
* Add test for nested async decorator patch.
* Add test for side_effect and wraps with a function.
* Add test for side_effect with an exception in the iterable.
(cherry picked from commit 54f743e)

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Jan 24, 2020

GH-18165 is a backport of this pull request to the 3.8 branch.

@tirkarthi

This comment has been minimized.

Copy link
Member Author

tirkarthi commented Jan 24, 2020

I feel this is safe to backport tests to 3.8 since AsyncMock is in 3.8 too and would help in catching regressions if any on 3.8.

miss-islington added a commit that referenced this pull request Jan 24, 2020
* Add test for nested async decorator patch.
* Add test for side_effect and wraps with a function.
* Add test for side_effect with an exception in the iterable.
(cherry picked from commit 54f743e)

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.