mik*_*ana 15 python google-app-engine unit-testing
更新:最初我没有意识到这只在单元测试运行时失败.
我在AppEngine中使用Python有一个工作任务队列.- 手动调用视图时,任务将添加到队列并运行 - 从单元测试调用时,将任务添加到队列失败并显示UnknownQueueError.
在阅读有关遇到此问题的其他人时,有一些建议taskqueue_stub
可以解决这个问题.但我不确定应该怎么做或为什么.
mik*_*ana 12
编辑:工作答案.我的问题是在单个单元测试中添加存根修复:将其移动到setUp()修复的东西.
在tests.py中
from google.appengine.api import apiproxy_stub_map
import os
class BlahTest(MyAppTestCase)
def setUp(self):
'''Ensure dev appserver task queue knows where to find queue.yaml'''
taskqueue_stub = apiproxy_stub_map.apiproxy.GetStub( 'taskqueue' )
dircontainingqueuedotyaml = os.path.dirname(os.path.dirname( __file__ ))
taskqueue_stub._root_path = dircontainingqueuedotyaml
Run Code Online (Sandbox Code Playgroud)
这现在有效.
归档时间: |
|
查看次数: |
2314 次 |
最近记录: |