def setUp(self): self.PatchObject(cros_build_lib, 'IsInsideChroot', return_value=False) # Sets up default options and evaluator object. self.options = cros_test_lib.EasyAttr( base_dir=self.tempdir, board=self.BOARD, test_name=self.TEST_NAME, metric=self.METRIC, metric_take_average=False, reuse_eval=True, chromium_dir=None, cros_dir=None, eval_passing_only=False) self.evaluator = autotest_evaluator.AutotestEvaluator(self.options)
def testInitMissingRequiredArgs(self): """Tests that AE() raises exception when required options are missing.""" options = cros_test_lib.EasyAttr() with self.assertRaises(Exception) as cm: autotest_evaluator.AutotestEvaluator(options) exception_message = str(cm.exception) self.assertIn('Missing command line', exception_message) self.assertIn('AutotestEvaluator', exception_message) for arg in autotest_evaluator.AutotestEvaluator.REQUIRED_ARGS: self.assertIn(arg, exception_message)
def UpdateOptionsAndEvaluator(self, options_to_update): """Updates self.options and self.evaluator. Based on updated self.options, it creates a new AutotestEvaluator instance and assigns to self.evaluator. Args: options_to_update: a dict to update self.options. """ self.options.update(options_to_update) self.evaluator = autotest_evaluator.AutotestEvaluator(self.options)