Bug 1255064 - MarionetteHarness should internally use dicts for arguments; r=maja_zf
authorRachel <rachel.b.king@gmail.com>
Fri, 18 Mar 2016 19:33:08 -0700
changeset 289701 8f3438a4505217734036cd792723f5dbf18ab529
parent 289700 272ec90eff7159e1c04a7aa588e4fc74e34873b0
child 289702 521e461d2eefbba78037cbec0aa6db89ad16c331
push id30108
push usercbook@mozilla.com
push dateTue, 22 Mar 2016 11:14:31 +0000
treeherdermozilla-central@ea6298e1b4f7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaja_zf
bugs1255064
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1255064 - MarionetteHarness should internally use dicts for arguments; r=maja_zf MozReview-Commit-ID: 94muKM44wVq
dom/media/test/external/mach_commands.py
testing/firefox-ui/mach_commands.py
testing/marionette/harness/marionette/runtests.py
testing/marionette/mach_commands.py
--- a/dom/media/test/external/mach_commands.py
+++ b/dom/media/test/external/mach_commands.py
@@ -45,17 +45,17 @@ def run_external_media_test(tests, testt
         setattr(args, k, v)
 
     parser.verify_usage(args)
 
     args.logger = commandline.setup_logging("Firefox External Media Tests",
                                             args,
                                             {"mach": sys.stdout})
     failed = mn_cli(MediaTestRunner, MediaTestArguments, FirefoxMediaHarness,
-                    args=args)
+                    args=vars(args))
 
     if failed > 0:
         return 1
     else:
         return 0
 
 
 @CommandProvider
--- a/testing/firefox-ui/mach_commands.py
+++ b/testing/firefox-ui/mach_commands.py
@@ -59,22 +59,17 @@ def run_firefox_ui_test(testtype=None, t
     # If no tests have been selected, set default ones
     if not kwargs.get('tests'):
         kwargs['tests'] = [os.path.join(fxui_dir, 'tests', test)
                            for test in test_types[testtype]['default_tests']]
 
     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:
         return 0
 
 
 @CommandProvider
 class MachCommands(MachCommandBase):
--- a/testing/marionette/harness/marionette/runtests.py
+++ b/testing/marionette/harness/marionette/runtests.py
@@ -48,33 +48,34 @@ class MarionetteHarness(object):
         mozlog.commandline.add_logging_group(parser)
         args = parser.parse_args()
         parser.verify_usage(args)
 
         logger = mozlog.commandline.setup_logging(
             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
 
 
 def cli(runner_class=MarionetteTestRunner, parser_class=MarionetteArguments,
         harness_class=MarionetteHarness, args=None):
     """
     Call the harness to parse args and run tests.
 
--- a/testing/marionette/mach_commands.py
+++ b/testing/marionette/mach_commands.py
@@ -62,17 +62,17 @@ def run_marionette(tests, b2g_path=None,
     for k, v in kwargs.iteritems():
         setattr(args, k, v)
 
     parser.verify_usage(args)
 
     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:
         return 0
 
 @CommandProvider
 class B2GCommands(MachCommandBase):
     def __init__(self, context):