Bug 1446374 - Add a `mach wpt-serve` command, r=ato
This start the web-platform-tests server locally but doesn't run any
tests.
MozReview-Commit-ID: K94zW4GXzBu
--- a/testing/web-platform/mach_commands.py
+++ b/testing/web-platform/mach_commands.py
@@ -320,16 +320,21 @@ def create_parser_create():
return p
def create_parser_manifest_update():
import manifestupdate
return manifestupdate.create_parser()
+def create_parser_serve():
+ from serve import serve
+ return serve.get_parser()
+
+
@CommandProvider
class MachCommands(MachCommandBase):
def setup(self):
self._activate_virtualenv()
@Command("web-platform-tests",
category="testing",
conditions=[conditions.is_firefox],
@@ -401,8 +406,22 @@ class MachCommands(MachCommandBase):
@Command("wpt-manifest-update",
category="testing",
parser=create_parser_manifest_update)
def wpt_manifest_update(self, **params):
self.setup()
wpt_manifest_updater = self._spawn(WPTManifestUpdater)
return wpt_manifest_updater.run_update(**params)
+
+ @Command("wpt-serve",
+ category="testing",
+ parser=create_parser_serve)
+ def serve(self, **params):
+ import logging
+ from serve import serve
+ root_logger = logging.getLogger()
+ handler = logging.StreamHandler(sys.stderr)
+ formatter = logging.Formatter(logging.BASIC_FORMAT)
+ handler.setFormatter(formatter)
+ root_logger.addHandler(handler)
+ root_logger.setLevel(logging.DEBUG)
+ serve.run(**params)