def test_run(self): host = MockHost() host.filesystem = MockFileSystem() local_wpt = LocalWPT(host) local_wpt.run(['echo', 'rutabaga']) self.assertEqual(host.executive.calls, [['echo', 'rutabaga']])
def _assert_version(self, port_name, expected_version): port = WinPort(port_name=port_name, filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive()) self.assertEquals(port.version(), expected_version)
def test_platform_duplicate_touched_test(self): paths = ['LayoutTests/test1.html', 'LayoutTests/test1.html', 'LayoutTests/platform/mock1/test2-expected.txt', 'LayoutTests/platform/mock2/test2-expected.txt'] fs = MockFileSystem() fs.write_text_file('/test.checkout/LayoutTests/test2.html', 'This is a test') fs, touched_tests = self.touched_files(paths, fs) self.assertItemsEqual(touched_tests, ['test1.html', 'test2.html'])
def _make_checkout(self): return Checkout(scm=MockSCM(), filesystem=MockFileSystem(), executive=MockExecutive())
def test_depot_tools_base_in_env_path(self): finder = PathFinder(MockFileSystem(), sys_path=['/foo'], env_path=['/baz/bin/depot_tools']) self.assertEqual(finder.depot_tools_base(), '/baz/bin/depot_tools')
def test_expected_touched_test(self): paths = ['LayoutTests/test-expected.txt', 'LayoutTests/no-test-expected.txt'] fs = MockFileSystem() fs.write_text_file('/test.checkout/LayoutTests/test.html', 'This is a test') fs, touched_tests = self.touched_files(paths, fs) self.assertItemsEqual(touched_tests, ['test.html'])
def test_layout_test_name_not_in_layout_tests_dir(self): finder = PathFinder(MockFileSystem()) self.assertIsNone(finder.layout_test_name('some/other/path/file.html'))
def test_chromium_base(self): finder = PathFinder(MockFileSystem()) self.assertEqual(finder.chromium_base(), '/mock-checkout')
def test_path_from_layout_tests(self): finder = PathFinder(MockFileSystem()) self.assertEqual( finder.path_from_layout_tests('external', 'wpt'), '/mock-checkout/third_party/WebKit/LayoutTests/external/wpt')
def test_layout_test_name(self): finder = PathFinder(MockFileSystem()) self.assertEqual( finder.layout_test_name( 'third_party/WebKit/LayoutTests/test/name.html'), 'test/name.html')
def test_perf_tests_dir(self): finder = PathFinder(MockFileSystem()) self.assertEqual(finder.perf_tests_dir(), '/mock-checkout/third_party/WebKit/PerformanceTests')
def test_layout_tests_dir(self): finder = PathFinder(MockFileSystem()) self.assertEqual(finder.layout_tests_dir(), '/mock-checkout/third_party/WebKit/LayoutTests')
def test_path_from_chromium_base(self): finder = PathFinder(MockFileSystem()) self.assertEqual(finder.path_from_chromium_base('foo', 'bar.baz'), '/mock-checkout/foo/bar.baz')
def test_path_from_webkit_base(self): c = config.Config(MockExecutive(), MockFileSystem()) self.assertTrue(c.path_from_webkit_base('foo'))
def test_depot_tools_base_not_found(self): finder = PathFinder(MockFileSystem(), sys_path=['/foo'], env_path=['/bar']) self.assertIsNone(finder.depot_tools_base())
def make_scm(self): scm = Git(cwd=".", executive=MockExecutive(), filesystem=MockFileSystem()) scm.read_git_config = lambda *args, **kw: "MOCKKEY:MOCKVALUE" return scm
def __init__(self, filesystem=None, executive=None): self.checkout_root = "/mock-checkout/third_party/WebKit" self.added_paths = set() self._filesystem = filesystem or MockFileSystem() self._executive = executive or MockExecutive()