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

Conversation

tirkarthi
Copy link
Member

  • 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
Copy link
Member Author

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

@miss-islington
Copy link
Contributor

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

miss-islington pushed 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 bedevere-bot removed the needs backport to 3.8 only security fixes label Jan 24, 2020
@bedevere-bot
Copy link

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

@tirkarthi
Copy link
Member Author

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>
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip issue skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants