def test_metadata_lsan_stack_depth(): tests = make_mock_manifest(("test", "a", 10), ("test", "a/b", 10)) test_metadata = manifestexpected.static.compile( BytesIO(test_2), {}, data_cls_getter=manifestexpected.data_cls_getter, test_path="a", url_base="") test = tests[2][2].pop() test_obj = wpttest.from_manifest(tests, test, [], test_metadata.get_test(test.id)) assert test_obj.lsan_max_stack_depth == 42 test = tests[1][2].pop() test_obj = wpttest.from_manifest(tests, test, [], test_metadata.get_test(test.id)) assert test_obj.lsan_max_stack_depth is None test_metadata = manifestexpected.static.compile( BytesIO(test_0), {}, data_cls_getter=manifestexpected.data_cls_getter, test_path="a", url_base="") inherit_metadata = [ manifestexpected.static.compile( BytesIO(dir_ini_2), {}, data_cls_getter=lambda x, y: manifestexpected.DirectoryManifest) ] test = tests[0][2].pop() test_obj = wpttest.from_manifest(tests, test, inherit_metadata, test_metadata.get_test(test.id)) assert test_obj.lsan_max_stack_depth == 42
def test_conditional(): tests = make_mock_manifest(("test", "a", 10), ("test", "a/b", 10), ("test", "c", 10)) test_metadata = manifestexpected.static.compile( BytesIO(test_1), {"os": "win"}, data_cls_getter=manifestexpected.data_cls_getter, test_path="a", url_base="") test = tests[1][2].pop() test_obj = wpttest.from_manifest(test, [], test_metadata.get_test(test.id)) assert test_obj.prefs == {"a": "b", "c": "d"} assert test_obj.expected() == "FAIL"
def test_conditional(): tests = make_mock_manifest(("test", "a", 10), ("test", "a/b", 10), ("test", "c", 10)) test_metadata = manifestexpected.static.compile(BytesIO(test_1), {"os": "win"}, data_cls_getter=manifestexpected.data_cls_getter, test_path="a", url_base="") test = tests[1][2].pop() test_obj = wpttest.from_manifest(test, [], test_metadata.get_test(test.id)) assert test_obj.prefs == {"a": "b", "c": "d"} assert test_obj.expected() == "FAIL"
def test_metadata_lsan_stack_depth(): tests = make_mock_manifest(("test", "a", 10), ("test", "a/b", 10)) test_metadata = manifestexpected.static.compile(BytesIO(test_2), {}, data_cls_getter=manifestexpected.data_cls_getter, test_path="a", url_base="") test = tests[2][2].pop() test_obj = wpttest.from_manifest(test, [], test_metadata.get_test(test.id)) assert test_obj.lsan_max_stack_depth == 42 test = tests[1][2].pop() test_obj = wpttest.from_manifest(test, [], test_metadata.get_test(test.id)) assert test_obj.lsan_max_stack_depth is None test_metadata = manifestexpected.static.compile(BytesIO(test_0), {}, data_cls_getter=manifestexpected.data_cls_getter, test_path="a", url_base="") inherit_metadata = [ manifestexpected.static.compile( BytesIO(dir_ini_2), {}, data_cls_getter=lambda x,y: manifestexpected.DirectoryManifest) ] test = tests[0][2].pop() test_obj = wpttest.from_manifest(test, inherit_metadata, test_metadata.get_test(test.id)) assert test_obj.lsan_max_stack_depth == 42
def test_metadata_fuzzy(): manifest_data = { "items": {"reftest": {"a/fuzzy.html": [["/a/fuzzy.html", [["/a/fuzzy-ref.html", "=="]], {"fuzzy": [[["/a/fuzzy.html", '/a/fuzzy-ref.html', '=='], [[2, 3], [10, 15]]]]}]]}}, "paths": {"a/fuzzy.html": ["0"*40, "reftest"]}, "version": wptmanifest.CURRENT_VERSION, "url_base": "/"} manifest = wptmanifest.Manifest.from_json(".", manifest_data) test_metadata = manifestexpected.static.compile(BytesIO(test_fuzzy), {}, data_cls_getter=manifestexpected.data_cls_getter, test_path="a/fuzzy.html", url_base="/") test = manifest.iterpath("a/fuzzy.html").next() test_obj = wpttest.from_manifest(manifest, test, [], test_metadata.get_test(test.id)) assert test_obj.fuzzy == {('/a/fuzzy.html', '/a/fuzzy-ref.html', '=='): [[2, 3], [10, 15]]} assert test_obj.fuzzy_override == {'/a/fuzzy-ref.html': ((1, 1), (200, 200))}
def test_metadata_inherit(): tests = make_mock_manifest(("test", "a", 10), ("test", "a/b", 10), ("test", "c", 10)) inherit_metadata = [ manifestexpected.static.compile( BytesIO(item), {}, data_cls_getter=lambda x,y: manifestexpected.DirectoryManifest) for item in [dir_ini_0, dir_ini_1]] test_metadata = manifestexpected.static.compile(BytesIO(test_0), {}, data_cls_getter=manifestexpected.data_cls_getter, test_path="a", url_base="") test = tests[0][2].pop() test_obj = wpttest.from_manifest(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"} assert test_obj.tags == {"a", "dir:a"}
def test_metadata_inherit(): tests = make_mock_manifest(("test", "a", 10), ("test", "a/b", 10), ("test", "c", 10)) inherit_metadata = [ manifestexpected.static.compile( BytesIO(item), {}, data_cls_getter=lambda x,y: manifestexpected.DirectoryManifest) for item in [dir_ini_0, dir_ini_1]] test_metadata = manifestexpected.static.compile(BytesIO(test_0), {}, data_cls_getter=manifestexpected.data_cls_getter, test_path="a", url_base="") test = tests[0][2].pop() test_obj = wpttest.from_manifest(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"} assert test_obj.tags == {"a", "dir:a"}
def test_metadata_fuzzy(): manifest_data = { "items": { "reftest": { "a/fuzzy.html": [[ "/a/fuzzy.html", [["/a/fuzzy-ref.html", "=="]], { "fuzzy": [[["/a/fuzzy.html", '/a/fuzzy-ref.html', '=='], [[2, 3], [10, 15]]]] } ]] } }, "paths": { "a/fuzzy.html": ["0" * 40, "reftest"] }, "version": wptmanifest.CURRENT_VERSION, "url_base": "/" } manifest = wptmanifest.Manifest.from_json(".", manifest_data) test_metadata = manifestexpected.static.compile( BytesIO(test_fuzzy), {}, data_cls_getter=manifestexpected.data_cls_getter, test_path="a/fuzzy.html", url_base="/") test = manifest.iterpath("a/fuzzy.html").next() test_obj = wpttest.from_manifest(manifest, test, [], test_metadata.get_test(test.id)) assert test_obj.fuzzy == { ('/a/fuzzy.html', '/a/fuzzy-ref.html', '=='): [[2, 3], [10, 15]] } assert test_obj.fuzzy_override == { '/a/fuzzy-ref.html': ((1, 1), (200, 200)) }