我建议使用 ext.testbed(Python 的本地单元测试)而不是 gaetestbed。正如 JJ(gaetestbed 的维护者)所指出的,它被 ext.testbed 所取代
如果您这样做并且想要测试现有和填充的数据存储,您可以这样做
def init_datastore_v3_stub(self, enable=True, datastore_file=None,
use_sqlite=False, **stub_kw_args):
"""Enable the datastore stub.
The 'datastore_file' argument can be the path to an existing
datastore file, or None (default) to use an in-memory datastore
that is initially empty. If you use the sqlite stub and have
'datastore_file' defined, changes you apply in a test will be
written to the file. If you use the default datastore stub,
changes are _not_ saved to disk unless you set save_changes=True.
Note that you can only access those entities of the datastore file
which have the same application ID associated with them as the
test run. You can change the application ID for a test with
setup_env().
Args:
enable: True if the fake service should be enabled, False if real
service should be disabled.
datastore_file: Filename of a dev_appserver datastore file.
use_sqlite: True to use the Sqlite stub, False (default) for file stub.
stub_kw_args: Keyword arguments passed on to the service stub.
"""
http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/ext/testbed/__init__.py#431