Bug 1497898 - Pass the manifest file directly into wpttest.from_manifest, r=ato

Depends on D8229

Differential Revision: https://phabricator.services.mozilla.com/D8230

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Graham 2018-11-16 18:46:57 +00:00
Родитель 322b139c9f
Коммит 98239a7695
4 изменённых файлов: 16 добавлений и 20 удалений

Просмотреть файл

@ -8,7 +8,7 @@ import sys
from collections import OrderedDict
from six import iteritems
from ..manifest import manifest, update
from ..manifest import manifest
here = os.path.dirname(__file__)
wpt_root = os.path.abspath(os.path.join(here, os.pardir, os.pardir))

Просмотреть файл

@ -1,5 +1,4 @@
import hashlib
import json
import os
import urlparse
from abc import ABCMeta, abstractmethod
@ -465,12 +464,12 @@ class TestLoader(object):
self._test_ids += [item.id for item in test_dict[test_type]]
return self._test_ids
def get_test(self, manifest_test, inherit_metadata, test_metadata):
def get_test(self, manifest_file, manifest_test, inherit_metadata, test_metadata):
if test_metadata is not None:
inherit_metadata.append(test_metadata)
test_metadata = test_metadata.get_test(manifest_test.id)
return wpttest.from_manifest(manifest_test, inherit_metadata, test_metadata)
return wpttest.from_manifest(manifest_file, manifest_test, inherit_metadata, test_metadata)
def load_dir_metadata(self, test_manifest, metadata_path, test_path):
rv = []
@ -507,15 +506,10 @@ class TestLoader(object):
for test_type, test_path, tests in manifest_items:
manifest_file = manifests_by_url_base[iter(tests).next().url_base]
metadata_path = self.manifests[manifest_file]["metadata_path"]
inherit_metadata, test_metadata = self.load_metadata(manifest_file, metadata_path, test_path)
for test in iterfilter(self.meta_filters,
self.iter_wpttest(inherit_metadata, test_metadata, tests)):
yield test_path, test_type, test
def iter_wpttest(self, inherit_metadata, test_metadata, tests):
for manifest_test in tests:
yield self.get_test(manifest_test, inherit_metadata, test_metadata)
for test in tests:
yield test_path, test_type, self.get_test(manifest_file, test, inherit_metadata, test_metadata)
def _load_tests(self):
"""Read in the tests from the manifest file and add them to a queue"""

Просмотреть файл

@ -60,7 +60,7 @@ def test_metadata_inherit():
url_base="")
test = tests[0][2].pop()
test_obj = wpttest.from_manifest(test, inherit_metadata, test_metadata.get_test(test.id))
test_obj = wpttest.from_manifest(tests, test, inherit_metadata, test_metadata.get_test(test.id))
assert test_obj.max_assertion_count == 3
assert test_obj.min_assertion_count == 1
assert test_obj.prefs == {"b": "c", "c": "d"}
@ -78,7 +78,7 @@ def test_conditional():
url_base="")
test = tests[1][2].pop()
test_obj = wpttest.from_manifest(test, [], test_metadata.get_test(test.id))
test_obj = wpttest.from_manifest(tests, test, [], test_metadata.get_test(test.id))
assert test_obj.prefs == {"a": "b", "c": "d"}
assert test_obj.expected() == "FAIL"

Просмотреть файл

@ -146,7 +146,7 @@ class Test(object):
return metadata
@classmethod
def from_manifest(cls, manifest_item, inherit_metadata, test_metadata):
def from_manifest(cls, manifest_file, manifest_item, inherit_metadata, test_metadata):
timeout = cls.long_timeout if manifest_item.timeout == "long" else cls.default_timeout
protocol = "https" if hasattr(manifest_item, "https") and manifest_item.https else "http"
return cls(manifest_item.source_file.tests_root,
@ -302,7 +302,7 @@ class TestharnessTest(Test):
self.scripts = scripts or []
@classmethod
def from_manifest(cls, manifest_item, inherit_metadata, test_metadata):
def from_manifest(cls, manifest_file, manifest_item, inherit_metadata, test_metadata):
timeout = cls.long_timeout if manifest_item.timeout == "long" else cls.default_timeout
protocol = "https" if hasattr(manifest_item, "https") and manifest_item.https else "http"
testdriver = manifest_item.testdriver if hasattr(manifest_item, "testdriver") else False
@ -352,6 +352,7 @@ class ReftestTest(Test):
@classmethod
def from_manifest(cls,
manifest_file,
manifest_test,
inherit_metadata,
test_metadata,
@ -394,9 +395,10 @@ class ReftestTest(Test):
references_seen.add(comparison_key)
manifest_node = manifest_test.manifest.get_reference(ref_url)
manifest_node = manifest_file.get_reference(ref_url)
if manifest_node:
reference = ReftestTest.from_manifest(manifest_node,
reference = ReftestTest.from_manifest(manifest_file,
manifest_node,
[],
None,
nodes,
@ -448,6 +450,6 @@ manifest_test_cls = {"reftest": ReftestTest,
"wdspec": WdspecTest}
def from_manifest(manifest_test, inherit_metadata, test_metadata):
def from_manifest(manifest_file, manifest_test, inherit_metadata, test_metadata):
test_cls = manifest_test_cls[manifest_test.item_type]
return test_cls.from_manifest(manifest_test, inherit_metadata, test_metadata)
return test_cls.from_manifest(manifest_file, manifest_test, inherit_metadata, test_metadata)