[英]Local testing for python 3 with datastore
Does anyone know how to simulate the datastore for local testing with python 3?有谁知道如何使用 python 3 模拟数据存储进行本地测试?
Java has the local test utils Java 有本地测试工具
python 2 has the testbed module python 2 有testbed 模块
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.如果您实际尝试做的是功能测试或集成测试,那么使用Cloud Datastore Emulator是最佳选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.