Bug 1255064 - MarionetteHarness should internally use dicts for arguments; r=maja_zf a=test-only
authorRachel <rachel.b.king@gmail.com>
Fri, 18 Mar 2016 19:33:08 -0700
changeset 324083 e0b56d6d35de9041a0853bee591f0bc2023c01e7
parent 324082 a704f4cf969cf5925e9cddae92a59ff502501f8f
child 324084 c6a28b230c749d4313e5ba8dc456f35a930f95ca
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaja_zf, test-only
bugs1255064
milestone47.0a2
Bug 1255064 - MarionetteHarness should internally use dicts for arguments; r=maja_zf a=test-only MozReview-Commit-ID: 94muKM44wVq
dom/media/test/external/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/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):