Uh oh!
There was an error while loading. Please reload this page.
Adding datastore _DEFAULTS stubs in all tests that use it. - #665
Conversation
coveralls
commented
Feb 18, 2015
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
tseaver
commented
Feb 19, 2015
I don't grasp the "main delta" bit: are you saying that was stuff you used to find places relying on implicit values, but didn't check it in after fixing them? |
dhermes
commented
Feb 19, 2015
This PR is really just about using The diff above is a hack I used to sniff out tests that relied on implicit behavior. It makes it so that anytime ifself.implicit:
raiseself.FooErrorSo if the container being tested was implicit, the test would fail. (I made a custom error, so it didn't get caught by any |
Introduces - concept of `implicit` for `_DefaultsContainer`. - testing module for datastore for patching Verified all test cases that would accidentally rely on _DEFAULTS implicit behavior by using a custom `_DefaultsContainer` that raises when the instance is implicit. Main delta for the custom properties: diff --git a/gcloud/datastore/_implicit_environ.py b/gcloud/datastore/_implicit_environ.py index 3afc954..1d38562 100644 --- a/gcloud/datastore/_implicit_environ.py +++ b/gcloud/datastore/_implicit_environ.py @@ -38,9 +38,37 @@ class _DefaultsContainer(object): :param dataset_id: Persistent implied dataset ID from environment. """ - def __init__(self, connection=None, dataset_id=None): - self.connection = connection - self.dataset_id = dataset_id + class FooError(Exception): + pass + + @Property + def dataset_id(self): + if self.implicit: + raise self.FooError + return self._dataset_id + + @dataset_id.setter + def dataset_id(self, value): + if self.implicit: + raise self.FooError + self._dataset_id = value + + @Property + def connection(self): + if self.implicit: + raise self.FooError + return self._connection + + @connection.setter + def connection(self, value): + if self.implicit: + raise self.FooError + self._connection = value + + def __init__(self, connection=None, dataset_id=None, implicit=False): + self.implicit = implicit + self._connection = connection + self._dataset_id = dataset_id def app_engine_id():
1f990e0 to
5e281ddComparedhermes
commented
Feb 19, 2015
coveralls
commented
Feb 19, 2015
tseaver
commented
Feb 19, 2015
LGTM. (I think some of this commit gets backed out in #667 anyway). |
Adding datastore _DEFAULTS stubs in all tests that use it.
* feat: added baseline model version used to generate the summary feat: added the platform of the virtual agent response messages PiperOrigin-RevId: 555788605 Source-Link: googleapis/googleapis@90a551c Source-Link: googleapis/googleapis-gen@30620b4 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzA2MjBiNGYzNDcxMzg2MDA4M2ZmZjAzNjk4MjkwMGIxMDA0Y2JmNSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
* chore(python): exclude setup.py in renovate config Source-Link: googleapis/synthtool@56da63e Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:993a058718e84a82fda04c3177e58f0a43281a996c7c395e0a56ccc4d6d210d7 * increase timeouts Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
This reverts commit d96eb5cdd8120bfec97d62b09512c6fecc325be8.
gcr.io/repo-automation-bots/owlbot-python:latest@sha256:4c981a6b6f2b8914a448d7b3a01688365be03e3ed26dfee399a6aa77fb112eaa
* changes to docs for sphinx * remvoing warnings * adding sample code * linting * modifying import settings * settings changes * line accidently deleted in creation.py * lint_setup_py test * adding new lines and making changes to read me Co-authored-by: Vikash Singh <3116482+vi3k6i5@users.noreply.github.com>
* samples: add async upload sample * make python3.6 compatible * woops, this one too * so annoying, can we deprecate 3.6 too? * be gone with you 3.6! * add comment clarifying how sample is run
Source-Link: googleapis/synthtool@4760d8d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
NOTE: Has #664 as diffbase
Introduces
implicitfor_DefaultsContainer.Verified all test cases that would accidentally rely on _DEFAULTS implicit
behavior by using a custom
_DefaultsContainerthat raises when theinstance is implicit.
Main delta for the custom properties: