Ejemplo n.º 1
0
def main(sdk_path, test_path):
    # If the sdk path points to a google cloud sdk installation
    # then we should alter it to point to the GAE platform location.
    if os.path.exists(os.path.join(sdk_path, 'platform/google_appengine')):
        sys.path.insert(0, os.path.join(sdk_path, 'platform/google_appengine'))
    else:
        sys.path.insert(0, sdk_path)

    # Ensure that the google.appengine.* packages are available
    # in tests as well as all bundled third-party packages.
    import dev_appserver
    dev_appserver.fix_sys_path()

    # Loading appengine_config from the current project ensures that any
    # changes to configuration there are available to all tests (e.g.
    # sys.path modifications, namespaces, etc.)
    try:
        import appengine_config
        (appengine_config)
    except ImportError:
        print "Note: unable to import appengine_config."

    from google.appengine.ext import testbed

    testbed = testbed.Testbed()
    testbed.activate()
    testbed.init_app_identity_stub()
    testbed.init_datastore_v3_stub()
    testbed.init_user_stub()
    testbed.init_memcache_stub()

    # Discover and run tests.
    suite = unittest.loader.TestLoader().discover(test_path)

    for root, dirs, files in os.walk(test_path):
        for name in dirs:
            # print(os.path.join(root,name))
            suite.addTests(unittest.loader.TestLoader().discover(
                os.path.join(root, name)))

    unittest.TextTestRunner(verbosity=2).run(suite)
Ejemplo n.º 2
0
def main(sdk_path, test_path):
    # If the sdk path points to a google cloud sdk installation
    # then we should alter it to point to the GAE platform location.
    if os.path.exists(os.path.join(sdk_path, 'platform/google_appengine')):
        sys.path.insert(0, os.path.join(sdk_path, 'platform/google_appengine'))
    else:
        sys.path.insert(0, sdk_path)

    # Ensure that the google.appengine.* packages are available
    # in tests as well as all bundled third-party packages.
    import dev_appserver
    dev_appserver.fix_sys_path()

    # Loading appengine_config from the current project ensures that any
    # changes to configuration there are available to all tests (e.g.
    # sys.path modifications, namespaces, etc.)
    try:
        import appengine_config
        (appengine_config)
    except ImportError:
        print "Note: unable to import appengine_config."

    from google.appengine.ext import testbed

    testbed = testbed.Testbed()
    testbed.activate()
    testbed.init_app_identity_stub()
    testbed.init_datastore_v3_stub()
    testbed.init_user_stub()
    testbed.init_memcache_stub()

    # Discover and run tests.
    suite = unittest.loader.TestLoader().discover(test_path)

    for root, dirs, files in os.walk(test_path):
        for name in dirs:
            # print(os.path.join(root,name))
            suite.addTests(unittest.loader.TestLoader().discover(os.path.join(root,name)))

    unittest.TextTestRunner(verbosity=2).run(suite)
Ejemplo n.º 3
0
import dev_appserver  # noqa
sys.path.extend(dev_appserver.EXTRA_PATHS)

from google.appengine.ext import testbed  # noqa

testbed = testbed.Testbed()
testbed.activate()

# If you have PIL installed, you can just use:
# testbed.init_all_stubs()

# If you don't have PIL installed, you have to manually deselect the
# images_stub and init the rest. You may be able to speed
# things up by only selecting the ones you need and commenting the rest.

# testbed.init_images_stub()
testbed.init_app_identity_stub()
testbed.init_blobstore_stub()
testbed.init_capability_stub()
testbed.init_channel_stub()
testbed.init_datastore_v3_stub()
testbed.init_files_stub()
testbed.init_logservice_stub()
testbed.init_mail_stub()
testbed.init_memcache_stub()
testbed.init_taskqueue_stub()
testbed.init_urlfetch_stub()
testbed.init_user_stub()
testbed.init_xmpp_stub()