FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Make run_in_transaction w/ timeout test deterministic. by tseaver · Pull Request #3147 · googleapis/google-cloud-python · GitHub

Make run_in_transaction w/ timeout test deterministic. - #3147

Merged
tseaver merged 1 commit into
googleapis:masterfrom
tseaver:3080-spanner-unittest-flaky-run_in_transaction
Mar 16, 2017
Merged

Make run_in_transaction w/ timeout test deterministic.#3147
tseaver merged 1 commit into
googleapis:masterfrom
tseaver:3080-spanner-unittest-flaky-run_in_transaction

Conversation

tseaver commented Mar 15, 2017

Copy link
Copy Markdown
Contributor

Closes #3080.

tseaver added api: spanner Issues related to the Spanner API. flaky testing labels Mar 15, 2017
tseaver requested review from daspecster and dhermes March 15, 2017 20:53
googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 15, 2017

dhermes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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()

tseaver commented Mar 15, 2017

Copy link
Copy Markdown
Contributor Author

I don't find that any more legible: the _FauxTimeModule is clearer, and DRY across the four tests which need to patch time.time and time.sleep.

Copy link
Copy Markdown
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.

tseaver mentioned this pull request Mar 16, 2017
3 tasks
tseaver merged commit 68a2a90 into googleapis:master Mar 16, 2017
tseaver deleted the 3080-spanner-unittest-flaky-run_in_transaction branch March 16, 2017 00:40
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://togithub.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://togithub.com/dialogflow/dialogflow-python-client-v2/blob/master/CHANGELOG.md#&#8203;080httpswwwgithubcomgoogleapisdialogflow-python-client-v2comparev072v080-2020-03-26)

[Compare Source](https://togithub.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 ([#&#8203;175](https://www.github.com/googleapis/dialogflow-python-client-v2/issues/175)) ([713846b](https://www.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) ([#&#8203;179](https://www.github.com/googleapis/dialogflow-python-client-v2/issues/179)) ([5a6f18e](https://www.github.com/googleapis/dialogflow-python-client-v2/commit/5a6f18e362b5dd87affbe75e0d0bfc0c21ab87a9))

##### [0.7.2](https://www.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 ([#&#8203;158](https://www.github.com/googleapis/dialogflow-python-client-v2/issues/158)) ([bf42fc4](https://www.github.com/googleapis/dialogflow-python-client-v2/commit/bf42fc45607b97bc040cbdacbde8ff5a4b6ad29b))

##### [0.7.1](https://www.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 ([#&#8203;156](https://www.github.com/googleapis/dialogflow-python-client-v2/issues/156)) ([69951d0](https://www.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).
parthea pushed a commit that referenced this pull request Mar 9, 2026
…_in_transaction

Make run_in_transaction w/ timeout test deterministic.
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

Labels

api: spanner Issues related to the Spanner API. cla: yes This human has signed the Contributor License Agreement. testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL