Bug 1256996 - Firefox ui mach commands must call parse_args and verify_usage, with args as dict; r=maja_zf
MozReview-Commit-ID: 5ZmD3BTO3ws
--- a/testing/firefox-ui/mach_commands.py
+++ b/testing/firefox-ui/mach_commands.py
@@ -24,21 +24,24 @@ 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):
- import argparse
-
from mozlog.structured import commandline
import firefox_ui_harness
+ if testtype == 'functional':
+ parser = setup_argument_parser_functional()
+ else:
+ parser = setup_argument_parser_update()
+
test_types = {
'functional': {
'default_tests': [
os.path.join('puppeteer', 'manifest.ini'),
os.path.join('functional', 'manifest.ini'),
],
'cli_module': firefox_ui_harness.cli_functional,
},
@@ -52,24 +55,34 @@ 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
- if not kwargs.get('tests'):
- kwargs['tests'] = [os.path.join(fxui_dir, 'tests', test)
+ if kwargs.get('tests'):
+ tests = kwargs.get('tests')
+ else:
+ 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})
- failed = test_types[testtype]['cli_module'].cli(args=kwargs)
+ args = parser.parse_args(args=tests)
+
+ for k, v in kwargs.iteritems():
+ setattr(args, k, v)
+
+ parser.verify_usage(args)
+
+ failed = test_types[testtype]['cli_module'].cli(args=vars(args))
+
if failed > 0:
return 1
else:
return 0
@CommandProvider
class MachCommands(MachCommandBase):