Bug 1258916 part 4 - Simplify code for skipping dir when populating test files. r=dbaron draft
authorXidorn Quan <quanxunzhen@gmail.com>
Wed, 23 Mar 2016 18:51:09 +0800
changeset 350725 36b6484806b42a44a80ed7a395856507cb924876
parent 350724 5a7da2a77c7188620b153adf38a90c0c8fabe0ba
child 350726 9489b25f5b142aceef8fd3863674bb63625ac75c
push id15401
push userxquan@mozilla.com
push dateThu, 14 Apr 2016 07:33:24 +0000
reviewersdbaron
bugs1258916
milestone48.0a1
Bug 1258916 part 4 - Simplify code for skipping dir when populating test files. r=dbaron MozReview-Commit-ID: CXDyfTAn5qv
layout/reftests/w3c-css/import-tests.py
--- a/layout/reftests/w3c-css/import-tests.py
+++ b/layout/reftests/w3c-css/import-tests.py
@@ -101,26 +101,22 @@ def remove_existing_dirs():
     for dirname in os.listdir(gDestPath):
         fulldir = os.path.join(gDestPath, dirname)
         if not os.path.isdir(fulldir):
             continue
         shutil.rmtree(fulldir)
 
 def populate_test_files():
     global gSubtrees, gTestfiles
+    excludeDirs = ["support", "reftest", "reference", "reports", "tools"]
     for subtree in gSubtrees:
         for dirpath, dirnames, filenames in os.walk(subtree, topdown=True):
-            if "support" in dirnames:
-               dirnames.remove("support")
-            if "reftest" in dirnames:
-               dirnames.remove("reftest")
-            if "reference" in dirnames:
-               dirnames.remove("reference")
-            if "reports" in dirnames:
-               dirnames.remove("reports")
+            for exclDir in excludeDirs:
+                if exclDir in dirnames:
+                    dirnames.remove(exclDir)
             for f in filenames:
                 if f == "README" or \
                    f.find("-ref.") != -1:
                     continue
                 gTestfiles.append(os.path.join(dirpath, f))
 
     gTestfiles.sort()