单元测试时刷新 python GAE 数据存储
有没有办法做到这一点,如果没有,其他人在使用一致性模型时如何在测试套件中设置数据?
I am following the recommendations on the app engine site for unit testing coding with GAE. I have set the PseudoRandomHRConsistencyPolicy probability to 0% to force the code to account for cases where the data is not yet consistent. The problem is that in my test suite I want to do some data setup (creating and adding data to the datastore) and need a way to force the datastore to flush all the data into a consistent state before I exercise the code under test. (ie. make sure that the datastore will return all global entities I have written the next time I do a query).
Is there any way to do this and if not, how are other people setting up data in their tests suites when they are using the consistency models?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
做到这一点的关键在 HRD 测试部分的末尾指出:
只需在测试中添加一些获取操作即可获取适当的记录,它们将显示在将来的查询中。
The key to doing this is noted near the end of the section on HRD testing:
Simply add some get operations to your tests to get the appropriate records, and they will show up in future queries.