當前位置: 首頁>>代碼示例>>Python>>正文


Python dev_appserver.fix_sys_path方法代碼示例

本文整理匯總了Python中dev_appserver.fix_sys_path方法的典型用法代碼示例。如果您正苦於以下問題:Python dev_appserver.fix_sys_path方法的具體用法?Python dev_appserver.fix_sys_path怎麽用?Python dev_appserver.fix_sys_path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dev_appserver的用法示例。


在下文中一共展示了dev_appserver.fix_sys_path方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: import dev_appserver [as 別名]
# 或者: from dev_appserver import fix_sys_path [as 別名]
def main(sdk_path, test_path, third_party_path=None):
  sys.path.insert(0, sdk_path)
  import dev_appserver
  dev_appserver.fix_sys_path()
  if third_party_path:
    sys.path.insert(0, third_party_path)

  try:
    import appengine_config
    (appengine_config)
  except ImportError:
    print "Note: unable to import appengine_config."
        
  suite = unittest2.loader.TestLoader().discover(test_path,
                                                 pattern='*_test.py')
  result = unittest2.TextTestRunner(verbosity=2).run(suite)
  if len(result.errors) > 0 or len(result.failures) > 0:
    sys.exit(1) 
開發者ID:google,項目名稱:gae-secure-scaffold-python,代碼行數:20,代碼來源:run_tests.py

示例2: main

# 需要導入模塊: import dev_appserver [as 別名]
# 或者: from dev_appserver import fix_sys_path [as 別名]
def main(sdk_path, test_path, test_pattern):
  # 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')):
    sdk_path = os.path.join(sdk_path, 'platform/google_appengine')

  # Make sure google.appengine.* modules are importable.
  fixup_paths(sdk_path)

  # Make sure all bundled third-party packages are available.
  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.')

  # Discover and run tests.
  suite = unittest.loader.TestLoader().discover(test_path, test_pattern)
  return unittest.TextTestRunner(verbosity=2).run(suite) 
開發者ID:lipis,項目名稱:github-stats,代碼行數:27,代碼來源:runner.py

示例3: main

# 需要導入模塊: import dev_appserver [as 別名]
# 或者: from dev_appserver import fix_sys_path [as 別名]
def main(sdk_path, test_path, test_pattern):
    # 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')):
        sdk_path = os.path.join(sdk_path, 'platform/google_appengine')

    # Make sure google.appengine.* modules are importable.
    fixup_paths(sdk_path)

    # Make sure all bundled third-party packages are available.
    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.')

    # Discover and run tests.
    suite = unittest.loader.TestLoader().discover(test_path, test_pattern)
    return unittest.TextTestRunner(verbosity=2).run(suite) 
開發者ID:ocadotechnology,項目名稱:gcp-census,代碼行數:27,代碼來源:test_runner.py

示例4: main

# 需要導入模塊: import dev_appserver [as 別名]
# 或者: from dev_appserver import fix_sys_path [as 別名]
def main(sdk_path, test_path):
  os.chdir('backend')
  sys.path.extend([sdk_path, '.', '../lib', '../testlib'])
  import dev_appserver
  dev_appserver.fix_sys_path()
  suite = unittest.loader.TestLoader().discover(test_path)
  if not unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful():
    sys.exit(-1) 
開發者ID:MayOneUS,項目名稱:pledgeservice,代碼行數:10,代碼來源:testrunner.py

示例5: main

# 需要導入模塊: import dev_appserver [as 別名]
# 或者: from dev_appserver import fix_sys_path [as 別名]
def main(sdk_path, test_path):
  sys.path.insert(0, sdk_path)
  sys.path.insert(0, os.path.join(test_path, '../'))
  sys.path.insert(0, os.path.join(test_path))
  import dev_appserver
  dev_appserver.fix_sys_path()
  suite = unittest.loader.TestLoader().discover(test_path)
  unittest.TextTestRunner(verbosity=10).run(suite) 
開發者ID:googlearchive,項目名稱:billing-export-python,代碼行數:10,代碼來源:run_server_tests.py

示例6: set_appengine_imports

# 需要導入模塊: import dev_appserver [as 別名]
# 或者: from dev_appserver import fix_sys_path [as 別名]
def set_appengine_imports():
  gae_path = os.getenv('GAE')
  if gae_path is None:
    return

  sys.path.insert(0, gae_path)
  sys.modules.pop('google', None)
  import dev_appserver
  dev_appserver.fix_sys_path()

  if GOOGLE_PACKAGE_PATH is not None:
    import google
    GOOGLE_PACKAGE_PATH.update(google.__path__)
    google.__path__ = list(GOOGLE_PACKAGE_PATH) 
開發者ID:GoogleCloudPlatform,項目名稱:datastore-ndb-python,代碼行數:16,代碼來源:google_imports.py

示例7: setup_gae_sdk

# 需要導入模塊: import dev_appserver [as 別名]
# 或者: from dev_appserver import fix_sys_path [as 別名]
def setup_gae_sdk(sdk_path):
  """Modifies sys.path and to be able to use Python portion of GAE SDK.

  Once this is called, other functions from this module know where to find GAE
  SDK and any AppEngine included Python module can be imported. The change is
  global and permanent.
  """
  global _GAE_SDK_PATH
  if _GAE_SDK_PATH:
    return
  _GAE_SDK_PATH = sdk_path

  sys.path.insert(0, sdk_path)
  # Sadly, coverage may inject google.protobuf in the path. Forcibly expulse it.
  if 'google' in sys.modules:
    del sys.modules['google']

  import dev_appserver
  dev_appserver.fix_sys_path()
  for i in sys.path[:]:
    if 'jinja2-2.6' in i:
      sys.path.remove(i)

  # Make 'yaml' variable (defined on top of this module) point to loaded module.
  global yaml
  import yaml as yaml_module
  yaml = yaml_module 
開發者ID:luci,項目名稱:luci-py,代碼行數:29,代碼來源:gae_sdk_utils.py

示例8: path_setup

# 需要導入模塊: import dev_appserver [as 別名]
# 或者: from dev_appserver import fix_sys_path [as 別名]
def path_setup():
    if 'GAE_SDK' in os.environ:
        SDK_PATH = os.environ['GAE_SDK']

        sys.path.insert(0, SDK_PATH)

        import dev_appserver

        dev_appserver.fix_sys_path()
    sys.path.append(os.path.join(PROJECT_PATH, 'appengine'))
    sys.path.append(os.path.join(PROJECT_PATH, 'apps')) 
開發者ID:renzon,項目名稱:tekton,代碼行數:13,代碼來源:testloader.py

示例9: main

# 需要導入模塊: import dev_appserver [as 別名]
# 或者: from dev_appserver import fix_sys_path [as 別名]
def main(sdk_path, test_path, test_pattern):
  # 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')):
    sdk_path = os.path.join(sdk_path, 'platform/google_appengine')

  # Make sure google.appengine.* modules are importable.
  fixup_paths(sdk_path)

  # Make sure all bundled third-party packages are available.
  import dev_appserver
  dev_appserver.fix_sys_path()

  # Set test env vars.
  os.environ['APPLICATION_ID'] = 'crmint-dev'

  # 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.')

  # Discover and run tests.
  suite = unittest.loader.TestLoader().discover(test_path, test_pattern)
  return unittest.TextTestRunner(verbosity=2).run(suite) 
開發者ID:google,項目名稱:crmint,代碼行數:30,代碼來源:runtests.py


注:本文中的dev_appserver.fix_sys_path方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。