简体   繁体   English

为什么在鼻子测试而不是Eclipse中出错?

[英]Why an error in nosetests and not in Eclipse?

I'm using a third-party library which needs urlfetch from google.appengine.api . 我使用它需要一个第三方库urlfetchgoogle.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. google_appengine目录位于我的PYTHONPATH上,如果直接从Eclipse执行单元测试,则不会看到任何错误。 However, if I use nosetests , I see this: 但是,如果我使用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"

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. 有人遇到类似的问题 ,但是我使用的是Python 2.5,我尝试使用--wheregoogle_appengine目录执行nosetests测试,并提供了我的单元测试目录的路径,我看到了相同的结果。

Why is this fine in Eclipse but fail in nosetests ? 为什么这在Eclipse中很好但是在nosetests失败了?

Calls to App Engine APIs are handled by API proxy modules. 对App Engine API的调用由API代理模块处理。 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. 在dev_appserver中,已为您设置了这些的本地开发版本,但如果尝试直接从命令行运行代码,则不会设置它们。

You can set them up yourself something like this , or you can just use nosegae . 您可以像这样设置自己,也可以只使用鼻涕

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM