Bug 1640012 [wpt PR 23734] - Exclude tentative files from the spec-link lint, a=testonly
authorStephen McGruer <smcgruer@chromium.org>
Tue, 26 May 2020 11:27:24 +0000
changeset 532474 c9dcf7e419231a3eb4e30d201ba3eb9a23e550be
parent 532473 6011255650937ac9ca9d3964e2514487f8f1a181
child 532475 ca3108f67d064cba313b276d75452ef12bef0d50
push id117176
push userwptsync@mozilla.com
push dateWed, 27 May 2020 11:45:04 +0000
treeherderautoland@c127b56cb97a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1640012, 23734
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1640012 [wpt PR 23734] - Exclude tentative files from the spec-link lint, a=testonly Automatic update from web-platform-tests Exclude tentative files from the spec-link lint The tenative file flag 'indicates that a test makes assertions not yet required by any specification, or in contradiction to some specification'. As such, tests that have this file flag may not have a specification section to link to, so they should be excluded. -- Fix test -- Fix mypy -- wpt-commits: 557528ba4346bcba23b9ef23a0e960223c329bf5, 197c08176b21153c8d111034b2a9c1e175e3f250, 2dc04dbf5a4e8128c27cf3ecab9eae6154cae35e wpt-pr: 23734
testing/web-platform/tests/tools/lint/lint.py
testing/web-platform/tests/tools/lint/tests/test_file_lints.py
testing/web-platform/tests/tools/manifest/sourcefile.py
testing/web-platform/tests/tools/manifest/tests/test_sourcefile.py
--- a/testing/web-platform/tests/tools/lint/lint.py
+++ b/testing/web-platform/tests/tools/lint/lint.py
@@ -462,16 +462,17 @@ def check_parsed(repo_root, path, f):
     if path.startswith("css/"):
         if (source_file.type == "support" and
             not source_file.name_is_non_test and
             not source_file.name_is_reference):
             return [rules.SupportWrongDir.error(path)]
 
         if (source_file.type != "support" and
             not source_file.name_is_reference and
+            not source_file.name_is_tentative and
             not source_file.spec_links):
             return [rules.MissingLink.error(path)]
 
     if source_file.name_is_non_test:
         return []
 
     if source_file.markup_type is None:
         return []
--- a/testing/web-platform/tests/tools/lint/tests/test_file_lints.py
+++ b/testing/web-platform/tests/tools/lint/tests/test_file_lints.py
@@ -791,16 +791,30 @@ def test_css_missing_file_manual():
     assert errors == [
         ('MISSING-LINK',
          'Testcase file must have a link to a spec',
          "css/foo/bar-manual.html",
          None),
     ]
 
 
+def test_css_missing_file_tentative():
+    code = b"""\
+<html xmlns="http://www.w3.org/1999/xhtml">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</html>
+"""
+
+    # The tentative flag covers tests that make assertions 'not yet required by
+    # any specification', so they need not have a specification link.
+    errors = check_file_contents("", "css/foo/bar.tentative.html", six.BytesIO(code))
+    assert not errors
+
+
 @pytest.mark.parametrize("filename", [
     "foo.worker.js",
     "foo.any.js",
 ])
 @pytest.mark.parametrize("input,error", [
     (b"""//META: title=foo\n""", None),
     (b"""//META: timeout=long\n""", None),
     (b"""// META: timeout=long\n""", None),
--- a/testing/web-platform/tests/tools/manifest/sourcefile.py
+++ b/testing/web-platform/tests/tools/manifest/sourcefile.py
@@ -403,16 +403,25 @@ class SourceFile(object):
         return "/reference/" in self.url or bool(reference_file_re.search(self.name))
 
     @property
     def name_is_crashtest(self):
         # type: () -> bool
         return self.type_flag == "crash" or "crashtests" in self.dir_path.split(os.path.sep)
 
     @property
+    def name_is_tentative(self):
+        # type: () -> bool
+        """Check if the file name matches the conditions for the file to be a
+        tentative file.
+
+        See https://web-platform-tests.org/writing-tests/file-names.html#test-features"""
+        return "tentative" in self.meta_flags
+
+    @property
     def markup_type(self):
         # type: () -> Optional[Text]
         """Return the type of markup contained in a file, based on its extension,
         or None if it doesn't contain markup"""
         ext = self.ext
 
         if not ext:
             return None
--- a/testing/web-platform/tests/tools/manifest/tests/test_sourcefile.py
+++ b/testing/web-platform/tests/tools/manifest/tests/test_sourcefile.py
@@ -117,16 +117,24 @@ def test_name_is_reference(rel_path):
     assert not s.name_is_non_test
     assert s.name_is_reference
 
     assert not s.content_is_testharness
 
     assert items(s) == []
 
 
+def test_name_is_tentative():
+    s = create("css/css-ui/appearance-revert-001.tentative.html")
+    assert s.name_is_tentative
+
+    s = create("css/css-ui/appearance-revert-001.html")
+    assert not s.name_is_tentative
+
+
 def test_worker():
     s = create("html/test.worker.js")
     assert not s.name_is_non_test
     assert not s.name_is_manual
     assert not s.name_is_visual
     assert not s.name_is_multi_global
     assert s.name_is_worker
     assert not s.name_is_window