-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Make run_in_transaction w/ timeout test deterministic. #3147
Make run_in_transaction w/ timeout test deterministic. #3147
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending CI. @tseaver I recommend checking out mock.patch
. This hand-rolled stuff is no longer needed.
times = [1, 1.5, 2.5]
time_method = mock.Mock(side_effect=times, spec=[])
time_mod = mock.Mock(time=time_method, spec=['time'])
with mock.patch('time', new=time_mod):
...
self.assertEqual(time_method.call_count, 2)
time_method.assert_called_with()
I don't find that any more legible: the |
I've gonna somewhat agree with @dhermes - the mock stuff is way more readable. I understand the DRY concerns, but you've also reinventing a very well-designed wheel by writing a custom class. I generally dislike running into these things in tests, as it requires me to break context to go and understand what the class is doing. I also am nowhere near as opinionated on testing as you are, @tseaver. You might hate me if you saw the tests in google-auth. |
…-flaky-run_in_transaction Make run_in_transaction w/ timeout test deterministic.
…loudPlatform/python-docs-samples#3147) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [dialogflow](https://github.com/dialogflow/dialogflow-python-client-v2) | minor | `==0.7.2` -> `==0.8.0` | --- ### Release Notes <details> <summary>dialogflow/dialogflow-python-client-v2</summary> ### [`v0.8.0`](https://github.com/dialogflow/dialogflow-python-client-v2/blob/master/CHANGELOG.md#​080httpswwwgithubcomgoogleapisdialogflow-python-client-v2comparev072v080-2020-03-26) [Compare Source](https://github.com/dialogflow/dialogflow-python-client-v2/compare/v0.7.2...v0.8.0) ##### Features - **dialogflow:** add `MediaContent`, `BrowseCarouselCard`, `ColumnProperties`in v2; add `SpeechContext`, `SpeechWordInfo`in v2; add `enable_word_info`, `speech_contexts`,`model` to InputAudioConfig in v2; add `subtitles` to `Intent.Message.ListSelect` in `v2beta1`; add `language_code` to `ListKnowledgeBase` in v2beta1; add `webhook_headers` to `QueryParameters` in v2beta1 ([#​175](https://github.com/googleapis/dialogflow-python-client-v2/issues/175)) ([713846b](https://github.com/googleapis/dialogflow-python-client-v2/commit/713846b7ed99eaf78cdf383aa9d39b43731b9a0d)) - add validation support to v2; add `output_audio_config_mask` to `detect_intent` method in v2beta1 and v2; add sub agent to v2beta1 (via synth) ([#​179](https://github.com/googleapis/dialogflow-python-client-v2/issues/179)) ([5a6f18e](https://github.com/googleapis/dialogflow-python-client-v2/commit/5a6f18e362b5dd87affbe75e0d0bfc0c21ab87a9)) ##### [0.7.2](https://github.com/googleapis/dialogflow-python-client-v2/compare/v0.7.1...v0.7.2) (2019-10-18) ##### Bug Fixes - define version once in setup.py ([#​158](https://github.com/googleapis/dialogflow-python-client-v2/issues/158)) ([bf42fc4](https://github.com/googleapis/dialogflow-python-client-v2/commit/bf42fc45607b97bc040cbdacbde8ff5a4b6ad29b)) ##### [0.7.1](https://github.com/googleapis/dialogflow-python-client-v2/compare/v0.7.0...v0.7.1) (2019-10-17) ##### Bug Fixes - pin google-api-core>=1.14.0, update format ([#​156](https://github.com/googleapis/dialogflow-python-client-v2/issues/156)) ([69951d0](https://github.com/googleapis/dialogflow-python-client-v2/commit/69951d013b7c99966848565e30d5ab1bad7229fb)) </details> --- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Never, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#GoogleCloudPlatform/python-docs-samples).
Closes #3080.