Python 谷歌应用程序引擎前瞻性搜索的测试平台存根

Python 谷歌应用程序引擎前瞻性搜索的测试平台存根,python,google-app-engine,Python,Google App Engine,我的问题基本上与“预期搜索”服务相同 我正在尝试对我使用前瞻性搜索的应用程序进行一些单元测试,我得到: AssertionError: No api proxy found for service "matcher" 我已经查看了、和,但我没有发现任何有用的参考。一旦您找到存根进行前瞻性搜索,已被接受的答案就指向了正确的方向 此类存根可在google.appengine.api.prospective\u search.prospective\u search\u存根中找到 我选择在我的代码中

我的问题基本上与“预期搜索”服务相同

我正在尝试对我使用前瞻性搜索的应用程序进行一些单元测试,我得到:

AssertionError: No api proxy found for service "matcher"
我已经查看了、和,但我没有发现任何有用的参考。

一旦您找到存根进行前瞻性搜索,已被接受的答案就指向了正确的方向

此类存根可在
google.appengine.api.prospective\u search.prospective\u search\u存根中找到

我选择在我的代码中修改
受支持的\u服务
列表,以便以后对SDK的更新不会破坏这一点。尽管我同意任何解决方案都是一种黑客行为

所以一切都是这样结束的

在测试模块中:

from google.appengine.ext import testbed
    #Workaround to avoid prospective search complain until there is a proper
    #testbed stub
from google.appengine.api.prospective_search.prospective_search_stub \
    import ProspectiveSearchStub
PROSPECTIVE_SEARCH_SERVICE_NAME = "matcher"
testbed.SUPPORTED_SERVICES.append(PROSPECTIVE_SEARCH_SERVICE_NAME)
def设置(自身):

ps_stub = ProspectiveSearchStub('./ps.txt', None)
self.testbed._register_stub(PROSPECTIVE_SEARCH_SERVICE_NAME, ps_stub)