Title: [193624] trunk/Tools
Revision
193624
Author
calva...@igalia.com
Date
2015-12-07 08:18:04 -0800 (Mon, 07 Dec 2015)

Log Message

Mock TestRepositories in W3C importer tests
https://bugs.webkit.org/show_bug.cgi?id=151938

Reviewed by Youenn Fablet.

The test importer tests should use a fake repository instead of using the real one. The reason why this happened
is because the test repository method reading the file was using the filesystem directly instead of taking the
host one. This patch changes that.

* Scripts/webkitpy/w3c/test_downloader.py:
(TestDownloader.load_test_repositories): Take a filesystem and use it. If we get no filesystem, we use the
default one.
(TestDownloader.__init__): When loading the repositories, pass the host filesystem.
* Scripts/webkitpy/w3c/test_importer_unittest.py:
(TestImporterTest.test_harnesslinks_conversion):
(TestImporterTest.test_submodules_generation): Use a fake test repository file.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (193623 => 193624)


--- trunk/Tools/ChangeLog	2015-12-07 13:49:41 UTC (rev 193623)
+++ trunk/Tools/ChangeLog	2015-12-07 16:18:04 UTC (rev 193624)
@@ -1,3 +1,22 @@
+2015-12-07  Xabier Rodriguez Calvar  <calva...@igalia.com>
+
+        Mock TestRepositories in W3C importer tests
+        https://bugs.webkit.org/show_bug.cgi?id=151938
+
+        Reviewed by Youenn Fablet.
+
+        The test importer tests should use a fake repository instead of using the real one. The reason why this happened
+        is because the test repository method reading the file was using the filesystem directly instead of taking the
+        host one. This patch changes that.
+
+        * Scripts/webkitpy/w3c/test_downloader.py:
+        (TestDownloader.load_test_repositories): Take a filesystem and use it. If we get no filesystem, we use the
+        default one.
+        (TestDownloader.__init__): When loading the repositories, pass the host filesystem.
+        * Scripts/webkitpy/w3c/test_importer_unittest.py:
+        (TestImporterTest.test_harnesslinks_conversion):
+        (TestImporterTest.test_submodules_generation): Use a fake test repository file.
+
 2015-12-07  David Kilzer  <ddkil...@apple.com>
 
         TestNetscapePlugIn: Address review comment on 193607

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_downloader.py (193623 => 193624)


--- trunk/Tools/Scripts/webkitpy/w3c/test_downloader.py	2015-12-07 13:49:41 UTC (rev 193623)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_downloader.py	2015-12-07 16:18:04 UTC (rev 193624)
@@ -51,8 +51,7 @@
         return options
 
     @staticmethod
-    def load_test_repositories():
-        filesystem = FileSystem()
+    def load_test_repositories(filesystem=FileSystem()):
         webkit_finder = WebKitFinder(filesystem)
         test_repositories_path = webkit_finder.path_from_webkit_base('LayoutTests', 'imported', 'w3c', 'resources', 'TestRepositories')
         return json.loads(filesystem.read_text_file(test_repositories_path))
@@ -65,7 +64,7 @@
 
         self.repository_directory = repository_directory
 
-        self.test_repositories = self.load_test_repositories()
+        self.test_repositories = self.load_test_repositories(self._filesystem)
 
         self.paths_to_skip = []
         self.paths_to_import = []

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py (193623 => 193624)


--- trunk/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py	2015-12-07 13:49:41 UTC (rev 193623)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py	2015-12-07 16:18:04 UTC (rev 193624)
@@ -46,6 +46,28 @@
     '/mock-checkout/LayoutTests/w3c/css-fake-1/README.txt': '',
 }
 
+FAKE_REPOSITORY = {
+    '/mock-checkout/LayoutTests/imported/w3c/resources/TestRepositories': '''
+[
+    {
+        "name": "csswg-tests",
+        "url": "https://github.com/w3c/csswg-test.git",
+        "revision": "9f45f89",
+        "paths_to_skip": [],
+        "paths_to_import": [],
+        "import_options": ["convert_test_harness_links"]
+    },
+    {
+        "name": "web-platform-tests",
+        "url": "https://github.com/w3c/web-platform-tests.git",
+        "revision": "dd553279c3",
+        "paths_to_skip": [],
+        "paths_to_import": [],
+        "import_options": []
+    }
+]
+''' }
+
 class TestImporterTest(unittest.TestCase):
 
     def test_import_dir_with_no_tests_and_no_hg(self):
@@ -118,6 +140,7 @@
             '/mock-checkout/Source/WebCore/css/CSSPropertyNames.in': '',
             '/mock-checkout/Source/WebCore/css/CSSValueKeywords.in': '',
         }
+        FAKE_FILES.update(FAKE_REPOSITORY)
 
         fs = self.import_downloaded_tests(['--no-fetch', '--import-all', '-d', 'w3c'], FAKE_FILES)
 
@@ -131,6 +154,7 @@
             '/mock-checkout/WebKitBuild/w3c-tests/csswg-tests/.gitmodules': '[submodule "tools/resources"]\n	path = tools/resources\n	url = ""  ignore = dirty\n',
             '/mock-checkout/WebKitBuild/w3c-tests/web-platform-tests/.gitmodules': '[submodule "tools/resources"]\n	path = tools/resources\n	url = ""  ignore = dirty\n',
         }
+        FAKE_FILES.update(FAKE_REPOSITORY)
 
         fs = self.import_downloaded_tests(['--no-fetch', '--import-all', '-d', 'w3c'], FAKE_FILES)
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to