gecko-dev/testing/web-platform/tests/tools/taskcluster/verify.py
jgraham 9f51cc6d3c Bug 1531960 [wpt PR 15619] - Fix taskcluster for master., a=testonly
Automatic update from web-platform-tests
Fix taskcluster for master. (#15619)

A couple more properties we were accessing only made sense for pull request events
--

wpt-commits: 21cc43a848a2d82cf351f029a0f4b91702e4c42a
wpt-pr: 15619
2019-04-01 14:42:29 +01:00

37 lines
1 KiB
Python

import argparse
import json
import os
import jsone
import yaml
here = os.path.dirname(__file__)
root = os.path.abspath(os.path.join(here, "..", ".."))
def create_parser():
return argparse.ArgumentParser()
def run(venv, **kwargs):
with open(os.path.join(root, ".taskcluster.yml")) as f:
template = yaml.safe_load(f)
events = [("pr_event.json", "github-pull-request", "Pull Request"),
("master_push_event.json", "github-push", "Push to master")]
for filename, tasks_for, title in events:
with open(os.path.join(here, "testdata", filename)) as f:
event = json.load(f)
context = {"tasks_for": tasks_for,
"event": event,
"as_slugid": lambda x: x}
data = jsone.render(template, context)
heading = "Got %s tasks for %s" % (len(data["tasks"]), title)
print(heading)
print("=" * len(heading))
for item in data["tasks"]:
print(json.dumps(item, indent=2))
print("")