Skip to content

Commit

Permalink
Bug 1536255 [wpt PR 15870] - Add manifest.TypeData.to_json to compute…
Browse files Browse the repository at this point in the history
… a TypeData's JSON obj, a=testonly

Automatic update from web-platform-tests
Add manifest.TypeData.to_json to compute a TypeData's JSON obj (#15870)

If we're still using TypeData.json_data, we don't need to create
a new object here.
--

wpt-commits: 7cc1301eaf905c0cb5fa32b4bc9252943ecdf6f4
wpt-pr: 15870
  • Loading branch information
gsnedders authored and jgraham committed Apr 1, 2019
1 parent f7414f8 commit 697fab0
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions testing/web-platform/tests/tools/manifest/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,21 @@ def set_json(self, tests_root, data):
self.tests_root = tests_root
self.json_data = data

def to_json(self):
data = {
from_os_path(path):
[t for t in sorted(test.to_json() for test in tests)]
for path, tests in iteritems(self.data)
}

if self.json_data is not None:
if not data:
# avoid copying if there's nothing here yet
return self.json_data
data.update(self.json_data)

return data

def paths(self):
"""Get a list of all paths containing items of this type,
without actually constructing all the items"""
Expand Down Expand Up @@ -363,11 +378,7 @@ def _compute_reftests(self, reftest_nodes):

def to_json(self):
out_items = {
test_type: {
from_os_path(path):
[t for t in sorted(test.to_json() for test in tests)]
for path, tests in iteritems(type_paths)
}
test_type: type_paths.to_json()
for test_type, type_paths in iteritems(self._data) if type_paths
}
rv = {"url_base": self.url_base,
Expand Down

0 comments on commit 697fab0

Please sign in to comment.