Title: bpo-17013: Extend Mock.called to allow waiting for calls by Kentzo · Pull Request #17133 · python/cpython · GitHub
Open Graph Title: bpo-17013: Extend Mock.called to allow waiting for calls by Kentzo · Pull Request #17133 · python/cpython
X Title: bpo-17013: Extend Mock.called to allow waiting for calls by Kentzo · Pull Request #17133 · python/cpython
Description: This implementation of bpo-17013 is alternative to #16094 Changes are based on my work for asynctest. Specifically on _AwaitEvent that was left out when related code was ported to CPython. Key features: Gives meaning to the existing Mock.called property, otherwise not much useful Does not require end users to do anything: change is automatically available in every Mock Utilizes existing semantics of python conditionals (both asyncio and threading) Accepting this change will allow me to port _AwaitEvent therefore giving identical semantics to both wait-for-calls and wait-for-awaits. I will provide necessary typing annotations for typeshed. Considerations: This approach changes type of the Mock.called property from bool to private bool-like _CallEvent. However, the only practical problem I could think of is if someone was checking type of Mock.called (e.g. via isinstance). That does not sound like a plausible problem: after all the property itself is seldom used with exception of conditional expressions where _CallEvent.__bool__ and _CallEvent.__eq__ is sufficient. It probably makes sense to provide convenience methods like wait_for_call, but I would like to hear the opinion of the reviewers. CC: @vstinner @tirkarthi @mariocj89 https://bugs.python.org/issue17013
Open Graph Description: This implementation of bpo-17013 is alternative to #16094 Changes are based on my work for asynctest. Specifically on _AwaitEvent that was left out when related code was ported to CPython. Key feat...
X Description: This implementation of bpo-17013 is alternative to #16094 Changes are based on my work for asynctest. Specifically on _AwaitEvent that was left out when related code was ported to CPython. Key feat...
Opengraph URL: https://github.com/python/cpython/pull/17133
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:6ad667e1-0999-fb7b-679c-f34df7d844b5 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | EA42:BA1AF:10DBB3:17C986:696A39BD |
| html-safe-nonce | b322fb7f38d4752546d40c81f0ac0ec4a3cbc09953368b65f984530cfd2be152 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTQyOkJBMUFGOjEwREJCMzoxN0M5ODY6Njk2QTM5QkQiLCJ2aXNpdG9yX2lkIjoiNDU5MzQ1OTc4OTYwNDQ2OTE4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e043420ed2ee4c05aafe95a896ac372bf6cb8afeef1802eba7a6b3d489b7c59e |
| hovercard-subject-tag | pull_request:340134678 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/17133/checks |
| twitter:image | https://avatars.githubusercontent.com/u/88809?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/88809?s=400&v=4 |
| og:image:alt | This implementation of bpo-17013 is alternative to #16094 Changes are based on my work for asynctest. Specifically on _AwaitEvent that was left out when related code was ported to CPython. Key feat... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 321736bfdb3f591415ae895a0459bec204b26a76caf47ba5c980634cfacc4538 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7a9163cefd1ea4bd06f8eb7c082f43e4e53f626f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width