为什么在nosetests 中出错而不是在Eclipse 中出错?
我使用的第三方库需要从 google.appengine.api
获取 urlfetch
。使用以下行将其导入到正在执行的测试中:
from google.appengine.api import urlfetch
google_appengine
目录位于我的 PYTHONPATH 上,如果我直接从 Eclipse 执行单元测试,则不会出现任何错误。但是,如果我使用 nosetests
,我会看到:
File "/home/wraith/dev/sdks/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 54, in CreateRPC
assert stub, 'No api proxy found for service "%s"' % service
AssertionError: No api proxy found for service "urlfetch"
有人有 类似问题,但我使用的是 Python 2.5,并且尝试使用 --where
从 google_appengine
目录执行 nosetests
并提供我的单元测试目录的路径,我看到相同的结果。
为什么这在 Eclipse 中没问题,但在 nosetests
中失败?
I'm using a third-party library which needs urlfetch
from google.appengine.api
. It is imported into the executing tests using this line:
from google.appengine.api import urlfetch
The google_appengine
directory is on my PYTHONPATH, and if I execute my unit tests directly from Eclipse, I see no errors. However, if I use nosetests
, I see this:
File "/home/wraith/dev/sdks/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 54, in CreateRPC
assert stub, 'No api proxy found for service "%s"' % service
AssertionError: No api proxy found for service "urlfetch"
Someone had a similar issue, but I am using Python 2.5 and I tried to execute nosetests
from the google_appengine
directory using --where
and providing the path to my unit test directory and I see the same result.
Why is this fine in Eclipse but fail in nosetests
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对 App Engine API 的调用由 API 代理模块处理。在 dev_appserver 中,已为您设置了这些的本地开发版本,但如果您尝试直接从命令行运行代码,则它们不会设置。
您可以自己设置它们,例如 this,或者您可以只使用 nosegae。
Calls to App Engine APIs are handled by API proxy modules. In the dev_appserver, local, development versions of these are set up for you, but if you try and run your code directly from the command line, they're not set up.
You can set them up yourself something like this, or you can just use nosegae.