How to run doctests on gql.py
[edit|delete]Here is a way to run doctests on gql.py from a web2py dir:
The trick is to put the appengine path on the sys.path and then run the file (gluon/contrib/gql.py). The appengine path will vary based on your platform.
export PYTHONPATH=.:/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine
python gluon/contrib/gql.py
Comments
Robin B on 2008-06-28 23:39:33 says
Using the GAE SDK datastore outside of dev_appserver.py requires manually setting up a stub for the datastore:
>>> from google.appengine.api import apiproxy_stub_map
>>> from google.appengine.api import datastore_file_stub
>>> apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
>>> apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3',\
datastore_file_stub.DatastoreFileStub('your_app_id', '/dev/null', '/dev/null'))
This will be added before the gql.py doctests, and will also need to be run before to any other model/controller doctests that attempt to use the GAE SDK datastore outside of dev_appserver.py. [inappropriate?]
Using the GAE SDK datastore outside of dev_appserver.py requires manually setting up a stub for the datastore:
>>> from google.appengine.api import apiproxy_stub_map
>>> from google.appengine.api import datastore_file_stub
>>> apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
>>> apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3',\
datastore_file_stub.DatastoreFileStub('your_app_id', '/dev/null', '/dev/null'))
This will be added before the gql.py doctests, and will also need to be run before to any other model/controller doctests that attempt to use the GAE SDK datastore outside of dev_appserver.py. [inappropriate?]