Bug 1256996 - Firefox ui mach commands must call parse_args and verify_usage; r?maja_zf draft
authorGloria Guy <gloriaanholt@gmail.com>
Tue, 29 Mar 2016 19:08:20 -0700
changeset 345688 d3db1f45b9aea69cc1185d4d5c28d1bcf9321fca
parent 343962 6202ade0e6d688ffb67932398e56cfc6fa04ceb3
child 517238 965056770b1b98a8b83d9f5563271f943656bb39
push id14139
push userbmo:gloriaanholt@gmail.com
push dateWed, 30 Mar 2016 02:30:00 +0000
reviewersmaja_zf
bugs1256996
milestone48.0a1
Bug 1256996 - Firefox ui mach commands must call parse_args and verify_usage; r?maja_zf MozReview-Commit-ID: 1MJYFZFMTxq
testing/firefox-ui/mach_commands.py
--- a/testing/firefox-ui/mach_commands.py
+++ b/testing/firefox-ui/mach_commands.py
@@ -24,22 +24,33 @@ def setup_argument_parser_functional():
 
 
 def setup_argument_parser_update():
     from firefox_ui_harness.arguments.update import UpdateArguments
     return UpdateArguments()
 
 
 def run_firefox_ui_test(testtype=None, topsrcdir=None, **kwargs):
+<<<<<<< local
     import argparse
+=======
+    import firefox_ui_harness
+    from mozlog.structured import commandline
+>>>>>>> histedit
 
+<<<<<<< local
     from mozlog.structured import commandline
     import firefox_ui_harness
 
     test_types = {
+=======
+    parser = setup_argument_parser_update()
+
+    test_types = {
+>>>>>>> histedit
         'functional': {
             'default_tests': [
                 os.path.join('puppeteer', 'manifest.ini'),
                 os.path.join('functional', 'manifest.ini'),
             ],
             'cli_module': firefox_ui_harness.cli_functional,
         },
         'update': {
@@ -52,28 +63,50 @@ def run_firefox_ui_test(testtype=None, t
 
     fxui_dir = os.path.join(topsrcdir, 'testing', 'firefox-ui')
 
     # Set the resources path which is used to serve test data via wptserve
     if not kwargs['server_root']:
         kwargs['server_root'] = os.path.join(fxui_dir, 'resources')
 
     # If no tests have been selected, set default ones
+<<<<<<< local
     if not kwargs.get('tests'):
         kwargs['tests'] = [os.path.join(fxui_dir, 'tests', test)
+=======
+    if not kwargs.get('tests'):
+        tests = [os.path.join(fxui_dir, 'tests', test)
+>>>>>>> histedit
                            for test in test_types[testtype]['default_tests']]
 
     kwargs['logger'] = commandline.setup_logging('Firefox UI - {} Tests'.format(testtype),
                                                  {"mach": sys.stdout})
 
+<<<<<<< local
     failed = test_types[testtype]['cli_module'].cli(args=kwargs)
     if failed > 0:
         return 1
     else:
         return 0
+=======
+
+    args = parser.parse_args(tests=tests)
+
+    for k, v in kwargs.iteritems():
+        setattr(args, k, v)
+
+    parser.verify_usage(args)
+
+    failed = test_types[testtype]['cli_module'].cli(args=kwargs)
+
+    if failed > 0:
+        return 1
+    else:
+        return 0
+>>>>>>> histedit
 
 
 @CommandProvider
 class MachCommands(MachCommandBase):
     """Mach command provider for Firefox ui tests."""
 
     @Command('firefox-ui-functional', category='testing',
              conditions=[conditions.is_firefox],