简体   繁体   中英

Local testing for python 3 with datastore

Does anyone know how to simulate the datastore for local testing with python 3?

Java has the local test utils

python 2 has the testbed module

The documentation suggests using the datastore emulator, but even though it is working, I think it is not ideal to have the tests depending on an external process and it takes a lot of time to start

A true unit test would not require an emulator/simulator of an external service. You should mock/monkeypatch/stub out any calls to datastore and make them return the expected response.

If what you're actually trying to do is a functional test or an integration test, using the Cloud Datastore Emulator is the best choice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM