当前位置: 首页>>代码示例>>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;未经允许,请勿转载。