Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(888)

Unified Diff: Tools/Scripts/webkitpy/w3c/test_importer_unittest.py

Issue 16465007: clean up test importer to use webkit_finder and update tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: re-upload Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Tools/Scripts/webkitpy/w3c/test_importer.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Tools/Scripts/webkitpy/w3c/test_importer_unittest.py
diff --git a/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py b/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py
index 526f1d287e6f43d5fc33f58edd666a56e9266b65..9103623dc79deb0c3a35851ffc76c7de363fe125 100644
--- a/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py
+++ b/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py
@@ -32,25 +32,29 @@ import shutil
import tempfile
import unittest2 as unittest
-from webkitpy.common.host import Host
+from webkitpy.common.host_mock import MockHost
+from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.common.system.executive_mock import MockExecutive2, ScriptError
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.w3c.test_importer import TestImporter
-DUMMY_SOURCE_DIR = '/w3c'
-DUMMY_REPO_DIR = '/blink/LayoutTests'
+FAKE_SOURCE_DIR = '/blink/w3c'
+FAKE_REPO_DIR = '/blink'
+
+FAKE_FILES = {
+ '/blink/w3c/empty_dir/README.txt': '',
+ '/mock-checkout/LayoutTests/w3c/README.txt': '',
+}
class TestImporterTest(unittest.TestCase):
def test_import_dir_with_no_tests_and_no_hg(self):
- # FIXME: Use MockHosts instead.
- host = Host()
+ host = MockHost()
host.executive = MockExecutive2(exception=OSError())
+ host.filesystem = MockFileSystem(files=FAKE_FILES)
- importer = TestImporter(host, DUMMY_SOURCE_DIR, DUMMY_REPO_DIR, optparse.Values({"overwrite": False}))
- importer.source_directory = importer.path_from_webkit_root("Tools", "Scripts", "webkitpy", "w3c")
- importer.destination_directory = tempfile.mkdtemp(prefix='csswg')
+ importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, optparse.Values({"overwrite": False}))
oc = OutputCapture()
oc.capture_output()
@@ -58,23 +62,18 @@ class TestImporterTest(unittest.TestCase):
importer.do_import()
finally:
oc.restore_output()
- shutil.rmtree(importer.destination_directory, ignore_errors=True)
def test_import_dir_with_no_tests(self):
- # FIXME: Use MockHosts instead.
- host = Host()
+ host = MockHost()
host.executive = MockExecutive2(exception=ScriptError("abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts/webkitpy/w3c' (.hg not found)!"))
+ host.filesystem = MockFileSystem(files=FAKE_FILES)
- importer = TestImporter(host, '/w3c', '/blink', optparse.Values({"overwrite": False}))
- importer.source_directory = importer.path_from_webkit_root("Tools", "Scripts", "webkitpy", "w3c")
- importer.destination_directory = tempfile.mkdtemp(prefix='csswg')
-
+ importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, optparse.Values({"overwrite": False}))
oc = OutputCapture()
oc.capture_output()
try:
importer.do_import()
finally:
oc.restore_output()
- shutil.rmtree(importer.destination_directory, ignore_errors=True)
- # FIXME: Need more tests, but need to add a mock filesystem w/ sample data.
+ # FIXME: Needs more tests.
« no previous file with comments | « Tools/Scripts/webkitpy/w3c/test_importer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698