Make run_in_transaction w/ timeout test deterministic.#3147
Merged
tseaver merged 1 commit intogoogleapis:masterfrom Mar 16, 2017
tseaver:3080-spanner-unittest-flaky-run_in_transaction
Merged
Make run_in_transaction w/ timeout test deterministic.#3147tseaver merged 1 commit intogoogleapis:masterfrom tseaver:3080-spanner-unittest-flaky-run_in_transaction
tseaver merged 1 commit intogoogleapis:masterfrom
tseaver:3080-spanner-unittest-flaky-run_in_transaction
Conversation
dhermes
approved these changes
Mar 15, 2017
Contributor
dhermes
left a comment
There was a problem hiding this comment.
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()
Contributor
Author
|
I don't find that any more legible: the |
Contributor
|
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. |
richkadel
pushed a commit
to richkadel/google-cloud-python
that referenced
this pull request
May 6, 2017
…-flaky-run_in_transaction Make run_in_transaction w/ timeout test deterministic.
vchudnov-g
pushed a commit
that referenced
this pull request
Sep 20, 2023
…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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3080.