简体   繁体   English

使用数据存储对 python 3 进行本地测试

[英]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.

相关问题 本地上的Appengine Python数据存储区 - Appengine python datastore on local appengine 使用数据存储设置本地主机以进行测试 - appengine set up local host with datastore for testing 在本地进行概念,使用和测试Cloud Datastore - Concepts, use and testing Cloud Datastore in local 单元测试时刷新python GAE数据存储区 - Flushing python GAE datastore when unit testing ubuntu上python的Python应用程序引擎导入本地数据存储 - app engine for python on ubuntu import datastore local 如何将本地Google App Engine Python数据存储区复制到本地Google App Engine Java数据存储区? - How do I copy local Google App Engine Python datastore to local Google App Engine Java datastore? Google App Engine(python)-通过python脚本连接到本地数据存储 - Google App Engine (python) - Connecting to local datastore via python script 如何在Google Appengine python SDK 1.8.1中迁移本地数据存储 - how to migrate local datastore in google appengine python SDK 1.8.1 App Engine python部署后是否会自动上传本地数据存储区以提供服务? - Will app engine python automatically upload local datastore to serve after deploying? 运行Google App Engine Python的本地数据存储区是否有任何限制? - Is there any limit for the local datastore running Google App Engine Python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM