phil-lopreiato / google-cloud-datastore-stub Goto Github PK
View Code? Open in Web Editor NEWAn Google Cloud Datastore in-memory stub for use in unit tests
License: MIT License
An Google Cloud Datastore in-memory stub for use in unit tests
License: MIT License
Error
from google.cloud.datastore_v1.proto import datastore_pb2_grpc
ModuleNotFoundError: No module named 'google.cloud.datastore_v1.proto'
python3.10
packges
google-cloud-ndb==2.2.0
InMemoryCloudDatastoreStub==0.0.15
Would it be a problem with the most current versions of ndb?
It would be great if the stub could be used to autogenerate the index.yaml file, i.e. you would run your test suite using the stub and the file would be generated. Similar to the datastore emulator or the python2 dev_appserver that would do this as you run the app locally. I have not looked into it, but the autogeneration code should be in the python appengine sdk, maybe it could be ported relatively easy
Hi Phil,
It seems like key.delete() is not working properly with the stub, any ideas?
Simple test case:
class TestStub(unittest.TestCase):
def test_delete(self):
entity = ndb.Model()
entity.put()
self.assertIsNotNone(entity.key)
entity.key.delete()
causes:
File "/InMemoryCloudDatastoreStub/_in_memory_store.py", line 92, in commitTransaction
return [self._applyMutation(m) for m in final_mutations]
File "/InMemoryCloudDatastoreStub/_in_memory_store.py", line 92, in <listcomp>
return [self._applyMutation(m) for m in final_mutations]
File "/InMemoryCloudDatastoreStub/_in_memory_store.py", line 100, in _applyMutation
mutation_key = self._mutation_key(mutation)
File "/InMemoryCloudDatastoreStub/_in_memory_store.py", line 138, in _mutation_key
key = self._maybe_assign_key(op.key)
AttributeError: key
versions:
[packages]
InMemoryCloudDatastoreStub = "==0.0.12"
google-cloud-ndb = "==1.7.1"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.