本文整理汇总了Python中webkitpy.common.system.outputcapture.OutputCapture.assert_outputs方法的典型用法代码示例。如果您正苦于以下问题:Python OutputCapture.assert_outputs方法的具体用法?Python OutputCapture.assert_outputs怎么用?Python OutputCapture.assert_outputs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webkitpy.common.system.outputcapture.OutputCapture
的用法示例。
在下文中一共展示了OutputCapture.assert_outputs方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_empty_state
# 需要导入模块: from webkitpy.common.system.outputcapture import OutputCapture [as 别名]
# 或者: from webkitpy.common.system.outputcapture.OutputCapture import assert_outputs [as 别名]
def test_empty_state(self):
capture = OutputCapture()
options = MockOptions()
options.reviewer = 'MOCK reviewer'
options.git_commit = 'MOCK git commit'
step = UpdateChangeLogsWithReviewer(MockTool(), options)
capture.assert_outputs(self, step.run, [{}])
示例2: test_basic
# 需要导入模块: from webkitpy.common.system.outputcapture import OutputCapture [as 别名]
# 或者: from webkitpy.common.system.outputcapture.OutputCapture import assert_outputs [as 别名]
def test_basic(self):
capture = OutputCapture()
step = SuggestReviewers(MockTool(), MockOptions(suggest_reviewers=True, git_commit=None))
expected_stdout = "The following reviewers have recently modified files in your patch:\nFoo Bar\n"
expected_logs = "Would you like to CC them?\n"
capture.assert_outputs(
self, step.run, [{"bug_id": "123"}], expected_stdout=expected_stdout, expected_logs=expected_logs
)
示例3: test_warn_if_application_is_xcode
# 需要导入模块: from webkitpy.common.system.outputcapture import OutputCapture [as 别名]
# 或者: from webkitpy.common.system.outputcapture.OutputCapture import assert_outputs [as 别名]
def test_warn_if_application_is_xcode(self):
output = OutputCapture()
user = User()
output.assert_outputs(self, user._warn_if_application_is_xcode, ["TextMate"])
output.assert_outputs(self, user._warn_if_application_is_xcode, ["/Applications/TextMate.app"])
output.assert_outputs(self, user._warn_if_application_is_xcode, ["XCode"]) # case sensitive matching
xcode_warning = "Instead of using Xcode.app, consider using EDITOR=\"xed --wait\".\n"
output.assert_outputs(self, user._warn_if_application_is_xcode, ["Xcode"], expected_stdout=xcode_warning)
output.assert_outputs(self, user._warn_if_application_is_xcode, ["/Developer/Applications/Xcode.app"], expected_stdout=xcode_warning)
示例4: test_ensure_bug_url
# 需要导入模块: from webkitpy.common.system.outputcapture import OutputCapture [as 别名]
# 或者: from webkitpy.common.system.outputcapture.OutputCapture import assert_outputs [as 别名]
def test_ensure_bug_url(self):
capture = OutputCapture()
step = PrepareChangeLog(MockTool(), MockOptions())
changelog_contents = u"%s\n%s" % (self._new_entry_boilerplate, self._example_changelog)
changelog_path = "ChangeLog"
state = {"bug_title": "Example title", "bug_id": 1234, "changelogs": [changelog_path]}
step._tool.filesystem = MockFileSystem()
step._tool.filesystem.write_text_file(changelog_path, changelog_contents)
capture.assert_outputs(self, step._ensure_bug_url, [state])
actual_contents = step._tool.filesystem.read_text_file(changelog_path)
expected_message = "Example title\n http://example.com/1234"
expected_contents = changelog_contents.replace(
"Need a short description (OOPS!).\n Need the bug URL (OOPS!).", expected_message
)
self.assertEqual(actual_contents, expected_contents)
示例5: test_apply_watch_list_local
# 需要导入模块: from webkitpy.common.system.outputcapture import OutputCapture [as 别名]
# 或者: from webkitpy.common.system.outputcapture.OutputCapture import assert_outputs [as 别名]
def test_apply_watch_list_local(self):
capture = OutputCapture()
step = ApplyWatchList(MockTool(log_executive=True), MockOptions())
state = {
'bug_id': '50001',
'diff': 'The diff',
}
expected_logs = """MockWatchList: determine_cc_and_messages
MOCK bug comment: bug_id=50001, cc=set(['[email protected]'])
--- Begin comment ---
Message2.
--- End comment ---
"""
capture.assert_outputs(self, step.run, [state], expected_logs=expected_logs)
示例6: test_commit_message_for_this_commit
# 需要导入模块: from webkitpy.common.system.outputcapture import OutputCapture [as 别名]
# 或者: from webkitpy.common.system.outputcapture.OutputCapture import assert_outputs [as 别名]
def test_commit_message_for_this_commit(self):
checkout = Checkout(None)
checkout.modified_changelogs = lambda: ["ChangeLog1", "ChangeLog2"]
output = OutputCapture()
expected_stderr = "Parsing ChangeLog: ChangeLog1\nParsing ChangeLog: ChangeLog2\n"
commit_message = output.assert_outputs(self, checkout.commit_message_for_this_commit, expected_stderr=expected_stderr)
self.assertEqual(commit_message.message(), self.expected_commit_message)
示例7: test_commit_info
# 需要导入模块: from webkitpy.common.system.outputcapture import OutputCapture [as 别名]
# 或者: from webkitpy.common.system.outputcapture.OutputCapture import assert_outputs [as 别名]
def test_commit_info(self):
command = AbstractRolloutPrepCommand()
tool = MockTool()
command.bind_to_tool(tool)
output = OutputCapture()
expected_stderr = "Preparing rollout for bug 42.\n"
commit_info = output.assert_outputs(self, command._commit_info, [1234], expected_stderr=expected_stderr)
self.assertTrue(commit_info)
mock_commit_info = Mock()
mock_commit_info.bug_id = lambda: None
tool._checkout.commit_info_for_revision = lambda revision: mock_commit_info
expected_stderr = "Unable to parse bug number from diff.\n"
commit_info = output.assert_outputs(self, command._commit_info, [1234], expected_stderr=expected_stderr)
self.assertEqual(commit_info, mock_commit_info)
示例8: run_prompt_test
# 需要导入模块: from webkitpy.common.system.outputcapture import OutputCapture [as 别名]
# 或者: from webkitpy.common.system.outputcapture.OutputCapture import assert_outputs [as 别名]
def run_prompt_test(inputs, expected_result, can_choose_multiple=False):
def mock_raw_input(message):
return inputs.pop(0)
output_capture = OutputCapture()
actual_result = output_capture.assert_outputs(
self,
User.prompt_with_list,
args=["title", ["foo", "bar"]],
kwargs={"can_choose_multiple": can_choose_multiple, "raw_input": mock_raw_input},
expected_stdout="title\n 1. foo\n 2. bar\n")
self.assertEqual(actual_result, expected_result)
self.assertEqual(len(inputs), 0)
示例9: test_build_driver
# 需要导入模块: from webkitpy.common.system.outputcapture import OutputCapture [as 别名]
# 或者: from webkitpy.common.system.outputcapture.OutputCapture import assert_outputs [as 别名]
def test_build_driver(self):
output = OutputCapture()
port = TestWebKitPort()
# Delay setting _executive to avoid logging during construction
port._executive = MockExecutive(should_log=True)
port._options = MockOptions(
configuration="Release"
) # This should not be necessary, but I think TestWebKitPort is actually reading from disk (and thus detects the current configuration).
expected_stderr = "MOCK run_command: ['Tools/Scripts/build-dumprendertree', '--release'], cwd=/mock-checkout\n"
self.assertTrue(output.assert_outputs(self, port._build_driver, expected_stderr=expected_stderr))
# Make sure when passed --webkit-test-runner web build the right tool.
port._options = MockOptions(webkit_test_runner=True, configuration="Release")
expected_stderr = (
"MOCK run_command: ['Tools/Scripts/build-webkittestrunner', '--release'], cwd=/mock-checkout\n"
)
self.assertTrue(output.assert_outputs(self, port._build_driver, expected_stderr=expected_stderr))
# Make sure that failure to build returns False.
port._executive = MockExecutive(should_log=True, should_throw=True)
expected_stderr = (
"MOCK run_command: ['Tools/Scripts/build-webkittestrunner', '--release'], cwd=/mock-checkout\n"
)
self.assertFalse(output.assert_outputs(self, port._build_driver, expected_stderr=expected_stderr))
示例10: test_guess_reviewer_from_bug
# 需要导入模块: from webkitpy.common.system.outputcapture import OutputCapture [as 别名]
# 或者: from webkitpy.common.system.outputcapture.OutputCapture import assert_outputs [as 别名]
def test_guess_reviewer_from_bug(self):
capture = OutputCapture()
step = UpdateChangeLogsWithReviewer(MockTool(), MockOptions())
expected_stderr = "0 reviewed patches on bug 75, cannot infer reviewer.\n"
capture.assert_outputs(self, step._guess_reviewer_from_bug, [75], expected_stderr=expected_stderr)
示例11: test_empty_state
# 需要导入模块: from webkitpy.common.system.outputcapture import OutputCapture [as 别名]
# 或者: from webkitpy.common.system.outputcapture.OutputCapture import assert_outputs [as 别名]
def test_empty_state(self):
capture = OutputCapture()
step = CloseBugForLandDiff(MockTool(), MockOptions())
expected_stderr = "Committed r49824: <http://trac.webkit.org/changeset/49824>\nNo bug id provided.\n"
capture.assert_outputs(self, step.run, [{"commit_text" : "Mock commit text"}], expected_stderr=expected_stderr)
示例12: test_guess_reviewer_from_multipatch_bug
# 需要导入模块: from webkitpy.common.system.outputcapture import OutputCapture [as 别名]
# 或者: from webkitpy.common.system.outputcapture.OutputCapture import assert_outputs [as 别名]
def test_guess_reviewer_from_multipatch_bug(self):
capture = OutputCapture()
step = UpdateChangeLogsWithReviewer(MockTool(), MockOptions())
expected_logs = "Guessing \"Reviewer2\" as reviewer from attachment 10001 on bug 50000.\n"
capture.assert_outputs(self, step._guess_reviewer_from_bug, [50000], expected_logs=expected_logs)
示例13: test_empty_state
# 需要导入模块: from webkitpy.common.system.outputcapture import OutputCapture [as 别名]
# 或者: from webkitpy.common.system.outputcapture.OutputCapture import assert_outputs [as 别名]
def test_empty_state(self):
capture = OutputCapture()
step = UpdateChangeLogsWithReviewer(MockTool(), Mock())
capture.assert_outputs(self, step.run, [{}])