def test_land_diff(self): expected_stderr = "Building WebKit\nRunning Python unit tests\nRunning Perl unit tests\nRunning JavaScriptCore tests\nRunning run-webkit-tests\nCommitted r49824: <http://trac.webkit.org/changeset/49824>\nUpdating bug 42\n" mock_tool = MockTool() mock_tool.scm().create_patch = Mock(return_value="Patch1\nMockPatch\n") mock_tool.checkout().modified_changelogs = Mock(return_value=[]) self.assert_execute_outputs(Land(), [42], options=self._default_options(), expected_stderr=expected_stderr, tool=mock_tool) # Make sure we're not calling expensive calls too often. self.assertEqual(mock_tool.scm().create_patch.call_count, 1) self.assertEqual(mock_tool.checkout().modified_changelogs.call_count, 1)
def test_land(self): expected_stderr = "Building WebKit\nRunning Python unit tests\nRunning Perl unit tests\nRunning JavaScriptCore tests\nRunning WebKit unit tests\nRunning run-webkit-tests\nCommitted r49824: <http://trac.webkit.org/changeset/49824>\nUpdating bug 50000\n" mock_tool = MockTool() mock_tool.scm().create_patch = Mock(return_value="Patch1\nMockPatch\n") mock_tool.checkout().modified_changelogs = Mock(return_value=[]) self.assert_execute_outputs(Land(), [50000], options=self._default_options(), expected_stderr=expected_stderr, tool=mock_tool) # Make sure we're not calling expensive calls too often. self.assertEqual(mock_tool.scm().create_patch.call_count, 0) self.assertEqual(mock_tool.checkout().modified_changelogs.call_count, 1)
def test_land_diff(self): expected_stderr = "Building WebKit\nRunning Python unit tests\nRunning Perl unit tests\nRunning JavaScriptCore tests\nRunning run-webkit-tests\nUpdating bug 42\n" mock_tool = MockTool() mock_tool.scm().create_patch = Mock() mock_tool.checkout().modified_changelogs = Mock(return_value=[]) self.assert_execute_outputs(Land(), [42], options=self._default_options(), expected_stderr=expected_stderr, tool=mock_tool) # Make sure we're not calling expensive calls too often. self.assertEqual(mock_tool.scm().create_patch.call_count, 0) self.assertEqual(mock_tool.checkout().modified_changelogs.call_count, 1)
def test_land(self): expected_logs = """Building WebKit Committed r49824: <https://commits.webkit.org/r49824> Adding comment and closing bug 50000 """ with self.mock_svn_remote(): mock_tool = MockTool() mock_tool.scm().create_patch = Mock(return_value="Patch1\nMockPatch\n") mock_tool.checkout().modified_changelogs = Mock(return_value=[]) self.assert_execute_outputs(Land(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool) # Make sure we're not calling expensive calls too often. self.assertEqual(mock_tool.scm().create_patch.call_count, 0) self.assertEqual(mock_tool.checkout().modified_changelogs.call_count, 1)
def _assert_emails_for_tests(self, emails): queue = CommitQueue() tool = MockTool() queue.bind_to_tool(tool) commit_infos = [MockCommitInfo(email) for email in emails] tool.checkout().recent_commit_infos_for_files = lambda paths: set(commit_infos) self.assertEqual(queue._author_emails_for_tests([]), set(emails))
def _assert_emails_for_test(self, emails): tool = MockTool() reporter = FlakyTestReporter(tool, 'dummy-queue') commit_infos = [MockCommitInfo(email) for email in emails] tool.checkout().recent_commit_infos_for_files = lambda paths: set( commit_infos) self.assertEqual(reporter._author_emails_for_test([]), set(emails))
def test_blame_line_for_revision(self): tool = MockTool() command = FailureReason() command.bind_to_tool(tool) # This is an artificial example, mostly to test the CommitInfo lookup failure case. self.assertEqual(command._blame_line_for_revision(0), "FAILED to fetch CommitInfo for r0, likely missing ChangeLog") def raising_mock(self): raise Exception("MESSAGE") tool.checkout().commit_info_for_revision = raising_mock self.assertEqual(command._blame_line_for_revision(0), "FAILED to fetch CommitInfo for r0, exception: MESSAGE")
def _assert_emails_for_test(self, emails): tool = MockTool() reporter = FlakyTestReporter(tool, 'dummy-queue') commit_infos = [MockCommitInfo(email) for email in emails] tool.checkout().recent_commit_infos_for_files = lambda paths: set(commit_infos) self.assertEqual(reporter._author_emails_for_test([]), set(emails))