Bug 1255064 - MarionetteHarness should internally use dicts for arguments; r=maja_zf

MozReview-Commit-ID: 94muKM44wVq

--HG--
extra : rebase_source : 502b677adcfc7390528d67119d261363f5f9e651
This commit is contained in:
Rachel 2016-03-18 19:33:08 -07:00
parent 207a3dd0f5
commit 0d6d8f8602
4 changed files with 12 additions and 16 deletions

View File

@ -50,7 +50,7 @@ def run_external_media_test(tests, testtype=None, topsrcdir=None, **kwargs):
args,
{"mach": sys.stdout})
failed = mn_cli(MediaTestRunner, MediaTestArguments, FirefoxMediaHarness,
args=args)
args=vars(args))
if failed > 0:
return 1

View File

@ -64,12 +64,7 @@ def run_firefox_ui_test(testtype=None, topsrcdir=None, **kwargs):
kwargs['logger'] = commandline.setup_logging('Firefox UI - {} Tests'.format(testtype),
{"mach": sys.stdout})
# Bug 1255064 - Marionette requieres an argparse Namespace. So fake one for now.
args = argparse.Namespace()
for k, v in kwargs.iteritems():
setattr(args, k, v)
failed = test_types[testtype]['cli_module'].cli(args=args)
failed = test_types[testtype]['cli_module'].cli(args=kwargs)
if failed > 0:
return 1
else:

View File

@ -53,23 +53,24 @@ class MarionetteHarness(object):
args.logger_name, args, logger_defaults or {"tbpl": sys.stdout})
args.logger = logger
return args
return vars(args)
def process_args(self):
if self.args.pydebugger:
MarionetteTestCase.pydebugger = __import__(self.args.pydebugger)
if self.args.get('pydebugger'):
MarionetteTestCase.pydebugger = __import__(self.args['pydebugger'])
def run(self):
try:
self.process_args()
args_dict = vars(self.args)
tests = args_dict.pop('tests')
runner = self._runner_class(**args_dict)
tests = self.args.pop('tests')
runner = self._runner_class(**self.args)
runner.run_tests(tests)
return runner.failed
except Exception:
self.args.logger.error('Failure during test execution.',
exc_info=True)
logger = self.args.get('logger')
if logger:
logger.error('Failure during test execution.',
exc_info=True)
raise

View File

@ -67,7 +67,7 @@ def run_marionette(tests, b2g_path=None, emulator=None, testtype=None,
args.logger = commandline.setup_logging("Marionette Unit Tests",
args,
{"mach": sys.stdout})
failed = MarionetteHarness(MarionetteTestRunner, args=args).run()
failed = MarionetteHarness(MarionetteTestRunner, args=vars(args)).run()
if failed > 0:
return 1
else: