Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a wpt command for updating expectation metadata.
The |wpt update-expectations| command takes a list of raw log files, and updates the expectation data located in the directory supplied thorugh the --metadata keyword argument. This metadata is used by subsequent test runs to determine the expected test results. By default the "product" property is used as a possible conditional on the data; this means that if multiple logs are passed in simultaneously then different results will be distinguished by "if product==foo" conditions in the metadata.
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import sys | ||
|
||
wpt_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) | ||
sys.path.insert(0, os.path.abspath(os.path.join(wpt_root, "tools"))) | ||
|
||
|
||
def create_parser_update(): | ||
from wptrunner import wptcommandline | ||
|
||
return wptcommandline.create_parser_update() | ||
|
||
|
||
def update_expectations(venv, **kwargs): | ||
from wptrunner import wptcommandline | ||
from wptrunner.update import setup_logging, WPTUpdate | ||
|
||
if not kwargs["tests_root"]: | ||
kwargs["tests_root"] = wpt_root | ||
|
||
if not kwargs["manifest_path"]: | ||
kwargs["manifest_path"] = os.path.join(wpt_root, "MANIFEST.json") | ||
|
||
if "product" not in kwargs["extra_property"]: | ||
kwargs["extra_property"].append("product") | ||
|
||
wptcommandline.check_args_update(kwargs) | ||
|
||
logger = setup_logging(kwargs, {"mach": sys.stdout}) | ||
|
||
updater = WPTUpdate(logger, **kwargs) | ||
updater.run() |