views:

40

answers:

1

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?

+1  A: 

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.

Nick Johnson
I've setup nose and nosegae, but am getting this error: raise AppConfigNotFoundError \ google.appengine.tools.dev_appserver.AppConfigNotFoundError. This is because the module I'm developing is not a GAE application, but merely uses one of its modules. Is there a way to use nosegae without having a GAE app?
Wraith
You need to create a dummy app.yaml - nosegae uses part of the dev_appserver to run its tests, which expects the app config.
Nick Johnson
Thank you for your help, Nick. I appreciate it.
Wraith