• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

GoogleCloudPlatform / google-cloud-python / 1165
100%

Build:
DEFAULT BRANCH: master
Ran 19 Feb 2015 07:12PM UTC
Jobs 1
Files 49
Run time 11s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
1165

Pull #665

travis-ci

dhermes
Adding _DEFAULTS stubs in all tests that use it.

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():
Pull Request #665: Adding datastore _DEFAULTS stubs in all tests that use it.

116 of 116 new or added lines in 11 files covered. (100.0%)

9269 of 9269 relevant lines covered (100.0%)

1.0 hits per line

Jobs
ID Job ID Ran Files Coverage
1 1165.1 19 Feb 2015 07:12PM UTC 0
100.0
Travis Job 1165.1
Source Files on build 1165
  • Tree
  • List 0
  • Changed 10
  • Source Changed 10
  • Coverage Changed 10
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Travis Build #1165
  • Pull Request #665
  • PR Base - master (#1164)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc