def _SetUpProcess(child, context): # pylint: disable=unused-argument ps_util.EnableListingStrayProcessesUponExitHook() # Make sure that we don't invokes cloud storage I/Os when we run the tests in # parallel. # TODO(nednguyen): always do this once telemetry tests in Chromium is updated # to prefetch files. # (https://github.com/catapult-project/catapult/issues/2192) args = context if args.disable_cloud_storage_io: os.environ[cloud_storage.DISABLE_CLOUD_STORAGE_IO] = '1' if binary_manager.NeedsInit(): # Typ doesn't keep the DependencyManager initialization in the child # processes. binary_manager.InitDependencyManager(context.client_configs) # We need to reset the handlers in case some other parts of telemetry already # set it to make this work. if not args.disable_logging_config: logging.getLogger().handlers = [] logging.basicConfig( level=logging.INFO, format='(%(levelname)s) %(asctime)s pid=%(process)d' ' %(module)s.%(funcName)s:%(lineno)d' ' %(message)s') if args.remote_platform_options.device == 'android': android_devices = android_device.FindAllAvailableDevices(args) if not android_devices: raise RuntimeError("No Android device found") android_devices.sort(key=lambda device: device.name) args.remote_platform_options.device = ( android_devices[child.worker_num - 1].guid) options_for_unittests.Push(args)
def _SetUpProcess(child, context): # pylint: disable=unused-argument ps_util.EnableListingStrayProcessesUponExitHook() if binary_manager.NeedsInit(): # Typ doesn't keep the DependencyManager initialization in the child # processes. binary_manager.InitDependencyManager(context.client_config) # We need to reset the handlers in case some other parts of telemetry already # set it to make this work. logging.getLogger().handlers = [] logging.basicConfig( level=logging.INFO, format='(%(levelname)s) %(asctime)s %(module)s.%(funcName)s:%(lineno)d ' '%(message)s') args = context if not args.disable_logging_config: logging.getLogger().handlers = [] logging.basicConfig( level=logging.INFO, format= '(%(levelname)s) %(asctime)s %(module)s.%(funcName)s:%(lineno)d' ' %(message)s') if args.device and args.device == 'android': android_devices = android_device.FindAllAvailableDevices(args) if not android_devices: raise RuntimeError("No Android device found") android_devices.sort(key=lambda device: device.name) args.device = android_devices[child.worker_num - 1].guid options_for_unittests.Push(args)
def ProcessCommandLineOptions(test_class, args): options = browser_options.BrowserFinderOptions() options.browser_type = 'any' parser = options.CreateParser(test_class.__doc__) test_class.AddCommandlineArgs(parser) finder_options, positional_args = parser.parse_args(args) finder_options.positional_args = positional_args options_for_unittests.Push(finder_options) return finder_options
def ProcessCommandLineOptions(test_class, project_config, args): options = browser_options.BrowserFinderOptions() options.browser_type = 'any' parser = options.CreateParser(test_class.__doc__) test_class.AddCommandlineArgs(parser) # Set the default chrome root variable. This is required for the # Android browser finder to function properly. parser.set_defaults(chrome_root=project_config.default_chrome_root) finder_options, positional_args = parser.parse_args(args) finder_options.positional_args = positional_args options_for_unittests.Push(finder_options) return finder_options
def run(self, test, progress_reporters, repeat_count, args): sys.path.append(path.GetUnittestDataDir()) result = TestResult(progress_reporters) result.startTestRun() try: options_for_unittests.Push(args) for _ in xrange(repeat_count): test(result) finally: options_for_unittests.Pop() result.stopTestRun() return result
def run(self, test, progress_reporters, repeat_count, args): util.AddDirToPythonPath(util.GetUnittestDataDir()) result = TestResult(progress_reporters) result.startTestRun() try: options_for_unittests.Push(args) for _ in xrange(repeat_count): test(result) finally: options_for_unittests.Pop() result.stopTestRun() return result
def ProcessCommandLineOptions(test_class, project_config, args): options = browser_options.BrowserFinderOptions() options.browser_type = 'any' parser = options.CreateParser(test_class.__doc__) test_class.AddCommandlineArgs(parser) # Set the default chrome root variable. This is required for the # Android browser finder to function properly. parser.set_defaults(chrome_root=project_config.default_chrome_root) finder_options, positional_args = parser.parse_args(args) finder_options.positional_args = positional_args options_for_unittests.Push(finder_options) # Use this to signal serially_executed_browser_test_case.LoadAllTestsInModule # not to load tests in cases it's not invoked by browser_test_runner # framework. finder_options.browser_test_runner_running = True return finder_options
def _SetUpProcess(child, context): # pylint: disable=W0613 args = context if args.device and args.device == 'android': android_devices = device_finder.GetDevicesMatchingOptions(args) args.device = android_devices[child.worker_num - 1].guid options_for_unittests.Push(args)