class MachCommands(MachCommandBase): @Command("web-platform-tests", category="testing", conditions=[conditions.is_firefox], parser=wptcommandline.create_parser(["firefox"])) def run_web_platform_tests(self, **params): self.setup() wpt_runner = self._spawn(WebPlatformTestsRunner) if params["list_test_groups"]: return wpt_runner.list_test_groups(**params) else: return wpt_runner.run_tests(**params) @Command("web-platform-tests-update", category="testing", parser=updatecommandline.create_parser()) def update_web_platform_tests(self, **params): self.setup() self.virtualenv_manager.install_pip_package('html5lib==0.99') self.virtualenv_manager.install_pip_package('requests') wpt_updater = self._spawn(WebPlatformTestsUpdater) return wpt_updater.run_update(**params) def setup(self): self._activate_virtualenv() @Command("web-platform-tests-reduce", category="testing", conditions=[conditions.is_firefox], parser=wptcommandline.create_parser_reduce(["firefox"])) def unstable_web_platform_tests(self, **params): self.setup() wpt_reduce = self._spawn(WebPlatformTestsReduce) return wpt_reduce.run_reduce(**params)
def create_parser_reduce(): from wptrunner import wptcommandline return wptcommandline.create_parser_reduce()