Пример #1
0
def main():
  """Prints out the output of get_dimensions() and get_state()."""
  sys.path.insert(0, os.path.join(ROOT_DIR, 'swarming_bot'))
  import test_env_bot
  test_env_bot.setup_test_env()
  from api import os_utilities
  from api import platforms

  # Pass an empty tag, so pop it up since it has no significance.
  devices = None
  if sys.platform == 'linux2':
    devices = platforms.android.get_devices(None)
    if devices:
      try:
        data = {
          u'dimensions': os_utilities.get_dimensions_all_devices_android(
              devices),
          u'state': os_utilities.get_state_all_devices_android(devices),
        }
      finally:
        platforms.android.close_devices(devices)
  if not devices:
    data = {
      u'dimensions': os_utilities.get_dimensions(),
      u'state': os_utilities.get_state(),
    }

  json.dump(data, sys.stdout, indent=2, sort_keys=True, separators=(',', ': '))
  print('')
  return 0
Пример #2
0
def main():
    """Prints out the output of get_dimensions() and get_state()."""
    sys.path.insert(0, os.path.join(ROOT_DIR, 'swarming_bot'))
    import test_env_bot
    test_env_bot.setup_test_env()
    from api import os_utilities
    from api import platforms

    # Pass an empty tag, so pop it up since it has no significance.
    devices = None
    if sys.platform == 'linux2':
        devices = platforms.android.get_devices(None)
        if devices:
            try:
                data = {
                    u'dimensions':
                    os_utilities.get_dimensions_all_devices_android(devices),
                    u'state':
                    os_utilities.get_state_all_devices_android(devices),
                }
            finally:
                platforms.android.close_devices(devices)
    if not devices:
        data = {
            u'dimensions': os_utilities.get_dimensions(),
            u'state': os_utilities.get_state(),
        }

    json.dump(data,
              sys.stdout,
              indent=2,
              sort_keys=True,
              separators=(',', ': '))
    print('')
    return 0
Пример #3
0
def run_tests_parralel():
    # TODO(jwata): add only root level directory to
    # avoid adhoc sys.path insertions
    # add path for test_support
    sys.path.insert(0, THIS_DIR)

    import test_env_bot
    test_env_bot.setup_test_env()

    # append attribute filter option "--attribute '!no_run'"
    # https://nose2.readthedocs.io/en/latest/plugins/attrib.html
    sys.argv.extend(['--attribute', '!no_run'])

    # enable plugins only on linux
    plugins = []
    if sys.platform.startswith('linux'):
        plugins.append('nose2.plugins.mp')

    # execute test runner
    sys.path.insert(0, COMPONENTS_DIR)
    from test_support import parallel_test_runner
    return parallel_test_runner.run_tests(python3=six.PY3, plugins=plugins)
Пример #4
0
#!/usr/bin/env python
# Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.

import json
import os
import re
import sys
import tempfile
import unittest

BOT_DIR = os.path.dirname(os.path.abspath(__file__))

import test_env_bot
test_env_bot.setup_test_env()

from utils import subprocess42

import fake_swarming
from bot_code import bot_main
from depot_tools import auto_stub
from depot_tools import fix_encoding
from utils import file_path


class TestCase(auto_stub.TestCase):
    def setUp(self):
        super(TestCase, self).setUp()
        self._tmpdir = tempfile.mkdtemp(prefix='swarming_main')
        self._zip_file = os.path.join(self._tmpdir, 'swarming_bot.zip')
Пример #5
0
def setup_test_env():
    """Sets up the environment for bot tests."""
    sys.path.insert(0, BOT_DIR)
    import test_env_bot
    test_env_bot.setup_test_env()
Пример #6
0
def setup_test_env():
  """Sets up the environment for bot tests."""
  sys.path.insert(0, BOT_DIR)
  import test_env_bot
  test_env_bot.setup_test_env()
Пример #7
0
#!/usr/bin/env python
# Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.

import json
import os
import re
import sys
import tempfile
import unittest

BOT_DIR = os.path.dirname(os.path.abspath(__file__))

import test_env_bot
test_env_bot.setup_test_env()

from utils import subprocess42

import fake_swarming
from bot_code import bot_main
from depot_tools import auto_stub
from depot_tools import fix_encoding
from utils import file_path


class TestCase(auto_stub.TestCase):
  def setUp(self):
    super(TestCase, self).setUp()
    self._tmpdir = tempfile.mkdtemp(prefix='swarming_main')
    self._zip_file = os.path.join(self._tmpdir, 'swarming_bot.zip')