Bug 1508533 [wpt PR 14137] - [wpt] Refactor internal function for clarity, a=testonly
authorjugglinmike <mike@mikepennisi.com>
Thu, 22 Nov 2018 10:34:37 +0000
changeset 507134 59c8ec95baa39ba312681c2840f00e9194c6e3b2
parent 507133 c3369eff0b340736674c3e7747e97443e5831c58
child 507135 828269b597ba3112bb72c961d02b9a4ac3e6c02f
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1508533, 14137
milestone65.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 1508533 [wpt PR 14137] - [wpt] Refactor internal function for clarity, a=testonly Automatic update from web-platform-tests[wpt] Refactor internal function for clarity (#14137) The `affected_by_interfaces` function is used for flow control in the following `if` condition: if rel_path in file_contents or repo_path in file_contents or affected_by_interfaces(file_contents): affected_testfiles.add(test_full_path) This usage suggests that the function should return a boolean value indicating whether the provided file contents are "affected." However, it was previously implemented to interact with the `affected_testfiles` set directly and return `None` in all cases. Refactor the implementation to adhere to the functional style implied by the call site. -- wpt-commits: a8607f41bb0ff223456623cf43b427d4ed5bc53f wpt-pr: 14137
testing/web-platform/tests/tools/wpt/testfiles.py
--- a/testing/web-platform/tests/tools/wpt/testfiles.py
+++ b/testing/web-platform/tests/tools/wpt/testfiles.py
@@ -259,18 +259,18 @@ def affected_testfiles(files_changed, sk
         return affected
 
     def affected_by_interfaces(file_contents):
         if len(interfaces_changed_names) > 0:
             if 'idlharness.js' in file_contents:
                 for interface in interfaces_changed_names:
                     regex = '[\'"]' + interface + '(\\.idl)?[\'"]'
                     if re.search(regex, file_contents):
-                        affected_testfiles.add(test_full_path)
-                        break
+                        return True
+        return False
 
     for root, dirs, fnames in os.walk(wpt_root):
         # Walk top_level_subdir looking for test files containing either the
         # relative filepath or absolute filepath to the changed files.
         if root == wpt_root:
             for dir_name in skip_tests:
                 dirs.remove(dir_name)
         for fname in fnames: