Hi.
 

> I'm really confused with the way to try Datastore in local. Please, give 
> me a minute to explain.
>

read this:
https://cloud.google.com/appengine/docs/python/tools/localunittesting

into test.py, that runs test suite (for example):

import sys, os
> import unittest
>
 

> app_engine = r"C:\Program Files (x86)\Google\google_appengine"
> sys.path.insert(1, app_engine)
> sys.path.insert(1, os.path.join(app_engine, 'lib', 'yaml', 'lib'))
>
 

> import dev_appserver
>
 

> dev_appserver.fix_sys_path()
> suite = unittest.TestLoader().discover('.')
> unittest.TextTestRunner().run(suite)


base class for GAE-specific unit tests:

import os
> import unittest
> from google.appengine.ext import testbed


 

> class GaeTestCase(unittest.TestCase):
>     def setUp(self):
>         # First, create an instance of the Testbed class.
>         self.testbed = testbed.Testbed()
>         # Then activate the testbed, which prepares the service stubs for 
> use.
>         self.testbed.activate()
>         # Next, declare which service stubs you want to use.
>         self.testbed.init_datastore_v3_stub()  # it's need for datastore 
> tests
>         self.testbed.init_memcache_stub()
>         self.testbed.init_app_identity_stub()
>         self.testbed.init_blobstore_stub()
>         self.testbed.init_files_stub()
>         self.testbed.init_taskqueue_stub(root_path="path_to_your_project")
>         self.taskqueue_stub = 
> self.testbed.get_stub(testbed.TASKQUEUE_SERVICE_NAME)
>         self.testbed.init_urlfetch_stub()
>         self.testbed.init_user_stub()
>     def tearDown(self):
>         self.testbed.deactivate()


WBR, Vitaly

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/e7b16f4e-2401-41bb-a841-386a7da9a741%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to