def test_prepare_with_cc(self): options = MockOptions() options.cc = "[email protected],[email protected]" options.sort_xcode_project = False options.non_interactive = True expected_logs = "MOCK create_bug\nbug_title: Mock user response\nbug_description: Mock user response\ncomponent: MOCK component\ncc: [email protected],[email protected]\n" self.assert_execute_outputs(Prepare(), [], expected_logs=expected_logs, options=options)
def _test_check_test_expectations(self, filename): capture = OutputCapture() options = MockOptions() options.git_commit = "" options.non_interactive = True tool = MockTool() tool.user = None # Will cause any access of tool.user to raise an exception. step = Commit(tool, options) state = { "changed_files": [filename + "XXX"], } tool.executive = MockExecutive(should_log=True, should_throw_when_run=False) expected_logs = "Committed r49824: <http://trac.webkit.org/changeset/49824>\n" capture.assert_outputs(self, step.run, [state], expected_logs=expected_logs) state = { "changed_files": ["platform/chromium/" + filename], } expected_logs = """MOCK run_and_throw_if_fail: ['mock-check-webkit-style', '--diff-files', 'platform/chromium/%s'], cwd=/mock-checkout Committed r49824: <http://trac.webkit.org/changeset/49824> """ % filename capture.assert_outputs(self, step.run, [state], expected_logs=expected_logs) tool.executive = MockExecutive(should_log=True, should_throw_when_run=set(["platform/chromium/" + filename])) self.assertRaises(ScriptError, capture.assert_outputs, self, step.run, [state])
def test_prepare_with_radar(self): options = MockOptions() options.cc_radar = True options.sort_xcode_project = False options.non_interactive = True expected_logs = "MOCK create_bug\nbug_title: Mock user response\nbug_description: Mock user response\ncomponent: MOCK component\ncc: [email protected],MOCK cc\n" self.assert_execute_outputs(Prepare(), [], expected_logs=expected_logs, options=options)
def _step_options(self): options = MockOptions() options.non_interactive = True options.port = 'MOCK port' options.quiet = True options.test = True return options
def test_upload_with_no_review_and_ews(self): options = MockOptions() options.cc = None options.check_style = True options.check_style_filter = None options.comment = None options.description = 'MOCK description' options.fast_cq = False options.non_interactive = False options.request_commit = False options.review = False options.ews = True options.sort_xcode_project = False options.suggest_reviewers = False expected_logs = """MOCK: user.open_url: file://... Was that diff correct? Obsoleting 2 old patches on bug 50000 MOCK reassign_bug: bug_id=50000, assignee=None MOCK add_patch_to_bug: bug_id=50000, description=MOCK description, mark_for_review=False, mark_for_commit_queue=False, mark_for_landing=False MOCK: user.open_url: http://example.com/50000 MOCK: submit_to_ews: 10001 """ self.assert_execute_outputs(Upload(), [50000], options=options, expected_logs=expected_logs)
def _test_check_test_expectations(self, filename): options = MockOptions() options.git_commit = "" options.non_interactive = True tool = MockTool() tool.user = None # Will cause any access of tool.user to raise an exception. step = Commit(tool, options) state = { "changed_files": [filename + "XXX"], } tool.executive = MockExecutive(should_log=True, should_throw_when_run=False) with OutputCapture(level=logging.INFO) as captured: step.run(state) self.assertEqual(captured.root.log.getvalue(), 'Committed r49824: <https://commits.webkit.org/r49824>\n') state = { "changed_files": ["platform/chromium/" + filename], } with OutputCapture(level=logging.INFO) as captured: step.run(state) self.assertEqual( captured.root.log.getvalue(), '''MOCK run_and_throw_if_fail: ['mock-check-webkit-style', '--diff-files', 'platform/chromium/{}'], cwd=/mock-checkout Committed r49824: <https://commits.webkit.org/r49824> '''.format(filename), ) tool.executive = MockExecutive(should_log=True, should_throw_when_run={"platform/chromium/" + filename}) with self.assertRaises(ScriptError), OutputCapture(): step.run(state)
def _step_options(self): options = MockOptions() options.group = None options.non_interactive = True options.port = 'MOCK port' options.quiet = True options.test = True options.iterate_on_new_tests = 0 return options
def _default_options(self): options = MockOptions() options.force_clean = False options.clean = True options.check_builders = True options.quiet = False options.non_interactive = False options.update = True options.build = True options.test = True options.close_bug = True return options
def _default_options(self): options = MockOptions() options.build = True options.build_style = True options.check_style = True options.check_style_filter = None options.clean = True options.close_bug = True options.force_clean = False options.non_interactive = False options.parent_command = 'MOCK parent command' options.quiet = False options.test = True options.update = True return options
def _default_options(self): options = MockOptions() options.build = True options.build_style = "release" options.check_style = True options.check_style_filter = None options.clean = True options.close_bug = True options.force_clean = False options.non_interactive = False options.parent_command = "MOCK parent command" options.quiet = False options.test = True options.update = True options.architecture = "MOCK ARCH" options.iterate_on_new_tests = 0 return options
def _default_options(self): options = MockOptions() options.build = True options.build_style = "release" options.check_style = True options.check_style_filter = None options.clean = True options.close_bug = True options.force_clean = False options.non_interactive = False options.parent_command = 'MOCK parent command' options.quiet = False options.test = True options.update = True options.architecture = 'MOCK ARCH' options.iterate_on_new_tests = 0 return options
def test_post(self): options = MockOptions() options.cc = None options.check_style = True options.check_style_filter = None options.comment = None options.description = "MOCK description" options.non_interactive = False options.request_commit = False options.review = True options.suggest_reviewers = False expected_logs = """MOCK: user.open_url: file://... Was that diff correct? Obsoleting 2 old patches on bug 50000 MOCK reassign_bug: bug_id=50000, assignee=None MOCK add_patch_to_bug: bug_id=50000, description=MOCK description, mark_for_review=True, mark_for_commit_queue=False, mark_for_landing=False MOCK: user.open_url: http://example.com/50000 """ self.assert_execute_outputs(Post(), [50000], options=options, expected_logs=expected_logs)
def test_runtests_leopard_commit_queue_hack(self): mock_options = MockOptions() mock_options.non_interactive = True step = RunTests(MockTool(log_executive=True), mock_options) # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. mock_port = WebKitPort() mock_port.name = lambda: "Mac" mock_port.is_leopard = lambda: True step.port = lambda: mock_port expected_stderr = """Running Python unit tests MOCK run_and_throw_if_fail: ['WebKitTools/Scripts/test-webkitpy'] Running Perl unit tests MOCK run_and_throw_if_fail: ['WebKitTools/Scripts/test-webkitperl'] Running JavaScriptCore tests MOCK run_and_throw_if_fail: ['WebKitTools/Scripts/run-javascriptcore-tests'] Running run-webkit-tests MOCK run_and_throw_if_fail: ['WebKitTools/Scripts/run-webkit-tests', '--no-launch-safari', '--exit-after-n-failures=1', '--wait-for-httpd', '--ignore-tests', 'compositing,media', '--quiet'] """ OutputCapture().assert_outputs(self, step.run, [{}], expected_stderr=expected_stderr)