【发布时间】:2021-04-10 17:29:03
【问题描述】:
我正在将 Python 2 GAE 应用程序迁移到 Python 3,并且正在将 ndb 替换为 cloud-ndb。这涉及更改行,例如
do_something_with_ndb()
到
with client.context() as context:
do_something_with_ndb()
对于 Flask 应用,您可以使用 WSGI 中间件(请参阅here)自动处理这个问题,这非常棒。
是否可以为单元测试做类似的事情?在我的测试代码中添加上下文很乏味。
寻找nose 和pytest 的解决方案,因为我都有。
【问题讨论】:
标签: python unit-testing google-app-engine app-engine-ndb google-app-engine-python