Ejemplo n.º 1
0
def CommonChecks(input_api, output_api):
  output = []
  def join(*args):
    return input_api.os_path.join(input_api.PresubmitLocalPath(), *args)

  gae_sdk_path = FindAppEngineSDK(input_api)
  if not gae_sdk_path:
    output.append(output_api.PresubmitError('Couldn\'t find AppEngine SDK.'))
    return output

  import sys
  old_sys_path = sys.path
  try:
    # Add GAE SDK modules to sys.path.
    sys.path = [gae_sdk_path] + sys.path
    import appcfg
    appcfg.fix_sys_path()
    # Add project specific paths to sys.path
    sys.path = [
      # See tests/test_env.py for more information.
      join('..', 'components'),
      join('..', 'third_party_local'),
    ] + sys.path
    black_list = list(input_api.DEFAULT_BLACK_LIST) + [
      r'.*_pb2\.py$',
    ]
    disabled_warnings = [
      'relative-import',
    ]
    output.extend(input_api.canned_checks.RunPylint(
        input_api, output_api,
        black_list=black_list,
        disabled_warnings=disabled_warnings))
  finally:
    sys.path = old_sys_path

  # Add the commented out directories when adding tests.
  test_directories = [
    input_api.PresubmitLocalPath(),
  ]

  blacklist = [
    # Never run the remote_smoke_test automatically. Should instead be run after
    # uploading a server instance.
    r'^remote_smoke_test\.py$'
  ]
  if not input_api.is_committing:
    # Skip smoke tests on upload.
    blacklist.append(r'.+_smoke_test\.py$')

  tests = []
  for directory in test_directories:
    tests.extend(
        input_api.canned_checks.GetUnitTestsInDirectory(
            input_api, output_api,
            directory,
            whitelist=[r'.+_test\.py$'],
            blacklist=blacklist))
  output.extend(input_api.RunTests(tests, parallel=True))
  return output
Ejemplo n.º 2
0
def CommonChecks(input_api, output_api):
  output = []
  def join(*args):
    return input_api.os_path.join(input_api.PresubmitLocalPath(), *args)

  gae_sdk_path = FindAppEngineSDK(input_api)
  if not gae_sdk_path:
    output.append(output_api.PresubmitError('Couldn\'t find AppEngine SDK.'))
    return output

  import sys
  old_sys_path = sys.path
  try:
    # Add GAE SDK modules to sys.path.
    sys.path = [gae_sdk_path] + sys.path
    import appcfg
    appcfg.fix_sys_path(appcfg.ENDPOINTSCFG_EXTRA_PATHS)
    # Add project specific paths to sys.path
    sys.path = [
      join('..', 'third_party_local'),
      join('third_party'),
    ] + sys.path
    black_list = list(input_api.DEFAULT_BLACK_LIST) + [
      r'.*_pb2\.py$',
    ]
    disabled_warnings = [
      # Pylint fails to recognize lazy module loading in components.auth.config,
      # no local disables work, so had to kill it globally.
      'cyclic-import',
      'relative-import',
    ]
    output.extend(input_api.canned_checks.RunPylint(
        input_api, output_api,
        black_list=black_list,
        disabled_warnings=disabled_warnings))
  finally:
    sys.path = old_sys_path

  # Add the commented out directories when adding tests.
  test_directories = [
    join('components'),
    join('components', 'auth'),
    join('components', 'auth', 'ui'),
    join('components', 'config'),
    join('components', 'datastore_utils'),
    join('components', 'ereporter2'),
    join('components', 'prpc'),
    join('components', 'prpc', 'discovery'),
    join('tests'),
  ]
  tests = []
  for directory in test_directories:
    tests.extend(
        input_api.canned_checks.GetUnitTestsInDirectory(
            input_api, output_api,
            directory,
            whitelist=[r'.+_test\.py$'],
            blacklist=[]))
  output.extend(input_api.RunTests(tests, parallel=True))
  return output
Ejemplo n.º 3
0
Archivo: gae.py Proyecto: iki/gae
def initialize(gae_sys_path=True, **argd):
    """ Updates settings dictionary and sys.path
    """ 
    settings.update(init_settings(**argd))

    if gae_sys_path:

         sys.path[0:0] = [ settings.GAE_SDK ]

         from appcfg import fix_sys_path

         sys.path[0:0] = []

         fix_sys_path()
Ejemplo n.º 4
0
def CommonChecks(input_api, output_api):
  output = []
  def join(*args):
    return input_api.os_path.join(input_api.PresubmitLocalPath(), *args)

  gae_sdk_path = FindAppEngineSDK(input_api)
  if not gae_sdk_path:
    output.append(output_api.PresubmitError('Couldn\'t find AppEngine SDK.'))
    return output

  import sys
  old_sys_path = sys.path
  try:
    # Add GAE SDK modules to sys.path.
    sys.path = [gae_sdk_path] + sys.path
    import appcfg
    appcfg.fix_sys_path(appcfg.ENDPOINTSCFG_EXTRA_PATHS)
    # Add project specific paths to sys.path
    sys.path = [
      join('..', 'third_party_local'),
      join('third_party'),
    ] + sys.path
    black_list = list(input_api.DEFAULT_BLACK_LIST) + [
      r'.*_pb2\.py$',
    ]
    disabled_warnings = [
      # Pylint fails to recognize lazy module loading in components.auth.config,
      # no local disables work, so had to kill it globally.
      'cyclic-import',
      'relative-import',
    ]
    output.extend(input_api.canned_checks.RunPylint(
        input_api, output_api,
        black_list=black_list,
        disabled_warnings=disabled_warnings))
  finally:
    sys.path = old_sys_path

  # Add the commented out directories when adding tests.
  test_directories = [
    join('components'),
    join('components', 'auth'),
    join('components', 'auth', 'ui'),
    join('components', 'datastore_utils'),
    join('components', 'ereporter2'),
  ]
  blacklist = []
  if not input_api.is_committing:
    # Skip smoke tests on upload.
    blacklist.append(r'.+_smoke_test\.py$')
  else:
    # 'tests' contains only smoke tests. Add it only when committing (otherwise
    # depot_tools emits warning "Out of 4 files, found none that matched ...").
    test_directories.append(join('tests'))

  tests = []
  for directory in test_directories:
    tests.extend(
        input_api.canned_checks.GetUnitTestsInDirectory(
            input_api, output_api,
            directory,
            whitelist=[r'.+_test\.py$'],
            blacklist=blacklist))
  output.extend(input_api.RunTests(tests, parallel=True))
  return output
Ejemplo n.º 5
0
def CommonChecks(input_api, output_api):
    output = []

    def join(*args):
        return input_api.os_path.join(input_api.PresubmitLocalPath(), *args)

    gae_sdk_path = FindAppEngineSDK(input_api)
    if not gae_sdk_path:
        output.append(
            output_api.PresubmitError('Couldn\'t find AppEngine SDK.'))
    if not input_api.os_path.isfile(join('..', '..', 'client', 'swarming.py')):
        output.append(
            output_api.PresubmitError(
                'Couldn\'t find ../../client. Please run:\n'
                '  git submodule init\n'
                '  git submodule update'))
    if output:
        return output

    import sys
    old_sys_path = sys.path
    try:
        # Add GAE SDK modules to sys.path.
        sys.path = [gae_sdk_path] + sys.path
        import appcfg
        appcfg.fix_sys_path()
        # Add project specific paths to sys.path
        sys.path = [
            join('..', 'components'),
            join('..', 'third_party_local'),
            join('..', '..', 'client', 'tests'),
        ] + sys.path
        black_list = list(input_api.DEFAULT_BLACK_LIST) + [
            r'.*_pb2\.py$',
            r'.*_pb2_grpc\.py$',
        ]
        disabled_warnings = [
            'relative-import',
        ]
        output.extend(
            input_api.canned_checks.RunPylint(
                input_api,
                output_api,
                black_list=black_list,
                disabled_warnings=disabled_warnings))
    finally:
        sys.path = old_sys_path

    test_directories = [
        input_api.PresubmitLocalPath(),
        join('server'),
        join('swarming_bot'),
        join('swarming_bot', 'api'),
        join('swarming_bot', 'api', 'platforms'),
        join('swarming_bot', 'bot_code'),
    ]

    blacklist = [
        # Never run the remote_smoke_test automatically. Should instead be run after
        # uploading a server instance.
        r'^remote_smoke_test\.py$'
    ]
    tests = []
    for directory in test_directories:
        tests.extend(
            input_api.canned_checks.GetUnitTestsInDirectory(
                input_api,
                output_api,
                directory,
                whitelist=[r'.+_test\.py$'],
                blacklist=blacklist))
    output.extend(input_api.RunTests(tests, parallel=True))
    return output
Ejemplo n.º 6
0
# coding=utf8

import appcfg
import logging
appcfg.fix_sys_path()

import unittest
import datetime
import time
import sys
from google.appengine.ext   import webapp
from google.appengine.ext   import db
from google.appengine.ext   import testbed
from django.utils           import simplejson
from twitter_mockup         import TwitterMockup

from controllers.incoming   import parseMessage 
from controllers.incoming   import processMessage
from controllers.incoming   import checkForAnswer
from controllers.learnlist  import getNextInterval
from controllers.learnlist  import addNewLearnListItem
from controllers.learnlist  import buildDailyList
from controllers.learnlist  import prepareTwitterMessage
from controllers.learnlist  import prepareQuestionMessage
from controllers.learnlist  import sendMessagesGenerator
from controllers.learnlist  import calculateAnswerRating
from controllers.learnlist  import prepareEmailMessagesGenerator
from controllers.learnlist  import acknowledgeQuestions
from controllers.vocabulary import getParameters
from controllers.rpchandler import getLatestAnswers
from controllers.rpchandler import deleteDictEntry