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/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:6cc73863-b32a-1fe4-eabb-69c4f0c8b273 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D994:1E9341:FCA543:15B46A5:6969F370 |
| html-safe-nonce | 65ba80bbf75f7b80b4b20b7fd3f85cd03eeede87e6d4afb24f8af40deee5c8f9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTk0OjFFOTM0MTpGQ0E1NDM6MTVCNDZBNTo2OTY5RjM3MCIsInZpc2l0b3JfaWQiOiIyMjcwMDY2MzUwMDE4MzkyOTQ0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 32ce83935cdee90328f031418c36190505f03697fadbac27b525e55f6740655e |
| hovercard-subject-tag | pull_request:340134678 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/files |
| 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 | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width