当前位置: 首页>>代码示例>>Python>>正文


Python mocktool.MockOptions类代码示例

本文整理汇总了Python中webkitpy.tool.mocktool.MockOptions的典型用法代码示例。如果您正苦于以下问题:Python MockOptions类的具体用法?Python MockOptions怎么用?Python MockOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MockOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_attach_to_bug_no_description_or_comment

    def test_attach_to_bug_no_description_or_comment(self):
        options = MockOptions()
        options.comment = None
        options.description = None
        expected_stderr = """MOCK add_attachment_to_bug: bug_id=50000, description=file.txt filename=None mimetype=None
"""
        self.assert_execute_outputs(AttachToBug(), [50000, "path/to/file.txt"], options=options, expected_stderr=expected_stderr)
开发者ID:,项目名称:,代码行数:7,代码来源:

示例2: test_rebaseline_all

    def test_rebaseline_all(self):
        old_exact_matches = builders._exact_matches
        builders._exact_matches = {
            "MOCK builder": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier"])},
            "MOCK builder (Debug)": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier", "debug"])},
        }

        command = RebaselineJson()
        tool = MockTool()
        options = MockOptions()
        options.optimize = True
        command.bind_to_tool(tool)
        tool.executive = MockExecutive(should_log=True)

        expected_stderr = """MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'user-scripts/another-test.html'], cwd=/mock-checkout
MOCK run_command: ['echo', 'optimize-baselines', '--suffixes', 'txt,png', 'user-scripts/another-test.html'], cwd=/mock-checkout
"""
        OutputCapture().assert_outputs(self, command._rebaseline, [options, {"user-scripts/another-test.html":{"MOCK builder": ["txt", "png"]}}], expected_stderr=expected_stderr)

        expected_stderr = """MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder (Debug)', '--test', 'user-scripts/another-test.html'], cwd=/mock-checkout
MOCK run_command: ['echo', 'optimize-baselines', '--suffixes', 'txt,png', 'user-scripts/another-test.html'], cwd=/mock-checkout
"""
        OutputCapture().assert_outputs(self, command._rebaseline, [options, {"user-scripts/another-test.html":{"MOCK builder (Debug)": ["txt", "png"]}}], expected_stderr=expected_stderr)

        expected_stderr = """MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'MOCK builder', '--test', 'user-scripts/another-test.html'], cwd=/mock-checkout
MOCK run_command: ['echo', 'optimize-baselines', '--suffixes', 'txt', 'user-scripts/another-test.html'], cwd=/mock-checkout
"""
        OutputCapture().assert_outputs(self, command._rebaseline, [options, {"user-scripts/another-test.html":{"MOCK builder (Debug)": ["txt", "png"], "MOCK builder": ["txt"]}}], expected_stderr=expected_stderr)

        builders._exact_matches = old_exact_matches
开发者ID:,项目名称:,代码行数:30,代码来源:

示例3: _step_options

 def _step_options(self):
     options = MockOptions()
     options.non_interactive = True
     options.port = 'MOCK port'
     options.quiet = True
     options.test = True
     return options
开发者ID:KDE,项目名称:android-qtwebkit,代码行数:7,代码来源:steps_unittest.py

示例4: test_check_test_expectations

    def test_check_test_expectations(self):
        capture = OutputCapture()
        options = MockOptions()
        options.git_commit = ""

        tool = MockTool()
        step = Commit(tool, options)
        state = {"changed_files": ["test_expectations.txtXXX"]}

        tool.executive = MockExecutive(should_log=True, should_throw_when_run=False)
        capture.assert_outputs(
            self, step.run, [state], expected_stderr="Committed r49824: <http://trac.webkit.org/changeset/49824>\n"
        )

        state = {"changed_files": ["platform/chromium/test_expectations.txt"]}
        capture.assert_outputs(
            self,
            step.run,
            [state],
            expected_stderr="MOCK run_and_throw_if_fail: ['mock-check-webkit-style', '--diff-files', 'platform/chromium/test_expectations.txt'], cwd=/mock-checkout\nCommitted r49824: <http://trac.webkit.org/changeset/49824>\n",
        )

        tool.executive = MockExecutive(
            should_log=True, should_throw_when_run=set(["platform/chromium/test_expectations.txt"])
        )
        self.assertRaises(SystemExit, capture.assert_outputs, self, step.run, [state])
开发者ID:,项目名称:,代码行数:26,代码来源:

示例5: _test_check_test_expectations

    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])
开发者ID:,项目名称:,代码行数:27,代码来源:

示例6: test_empty_state

 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, [{}])
开发者ID:0x4d52,项目名称:JavaScriptCore-X,代码行数:7,代码来源:updatechangelogswithreview_unittest.py

示例7: test_attach_to_bug

    def test_attach_to_bug(self):
        options = MockOptions()
        options.comment = "extra comment"
        options.description = "file description"
        expected_stderr = """MOCK add_attachment_to_bug: bug_id=50000, description=file description filename=None mimetype=None
-- Begin comment --
extra comment
-- End comment --
"""
        self.assert_execute_outputs(AttachToBug(), [50000, "path/to/file.txt", "file description"], options=options, expected_stderr=expected_stderr)
开发者ID:,项目名称:,代码行数:10,代码来源:

示例8: _make_options

 def _make_options(self, verbose=False, **kwargs):
     defaults = {
         'committer_minimum': 10,
         'max_commit_age': 9,
         'reviewer_minimum': 80,
         'show_commits': False,
         'verbose': verbose,
     }
     options = MockOptions(**defaults)
     options.update(**kwargs)
     return options
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:11,代码来源:suggestnominations_unittest.py

示例9: test_command_aliases

 def test_command_aliases(self):
     tool = MockTool()
     options = MockOptions()
     options.ensure_value("confirm", False)
     options.ensure_value("seconds_to_sleep", 120)
     sheriffbot = SheriffBot()
     sheriffbot.execute(options, [], tool, MockQueueEngine)
     sheriffbot.begin_work_queue()
     irc_bot = sheriffbot._irc_bot
     # Test Rollout command aliases
     revert_command, args = irc_bot._parse_command_and_args("revert")
     self.assertEqual(revert_command, Rollout)
开发者ID:3163504123,项目名称:phantomjs,代码行数:12,代码来源:sheriffbot_unittest.py

示例10: _default_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
开发者ID:,项目名称:,代码行数:12,代码来源:

示例11: test_skipped_layout_tests

    def test_skipped_layout_tests(self):
        mock_options = MockOptions()
        mock_options.configuration = 'release'
        port = ChromiumPortTest.TestLinuxPort(options=mock_options)

        fake_test = 'fast/js/not-good.js'

        port.test_expectations = lambda: """BUG_TEST SKIP : fast/js/not-good.js = TEXT
LINUX WIN : fast/js/very-good.js = TIMEOUT PASS"""
        port.test_expectations_overrides = lambda: ''
        port.tests = lambda paths: set()
        port.test_exists = lambda test: True

        skipped_tests = port.skipped_layout_tests(extra_test_files=[fake_test, ])
        self.assertTrue("fast/js/not-good.js" in skipped_tests)
开发者ID:,项目名称:,代码行数:15,代码来源:

示例12: test_post

    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)
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:19,代码来源:upload_unittest.py

示例13: test_runtests_leopard_commit_queue_hack

    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)
开发者ID:,项目名称:,代码行数:19,代码来源:

示例14: test_command_aliases

 def test_command_aliases(self):
     tool = MockTool()
     options = MockOptions()
     options.ensure_value("confirm", False)
     sheriffbot = SheriffBot()
     sheriffbot.execute(options, [], tool, MockQueueEngine)
     sheriffbot.begin_work_queue()
     irc_bot = sheriffbot._irc_bot
     # Test Rollout command aliases
     revert_command, args = irc_bot._parse_command_and_args("revert")
     self.assertEqual(revert_command, Rollout)
     # Test Sheriffs command aliases
     gardeners_command, args = irc_bot._parse_command_and_args("gardeners")
     self.assertEqual(gardeners_command, Sheriffs)
     sherifs_command, args = irc_bot._parse_command_and_args("sherifs")
     self.assertEqual(sherifs_command, Sheriffs)
     sherrifs_command, args = irc_bot._parse_command_and_args("sherrifs")
     self.assertEqual(sherrifs_command, Sheriffs)
     sherriffs_command, args = irc_bot._parse_command_and_args("sherriffs")
     self.assertEqual(sherriffs_command, Sheriffs)
开发者ID:,项目名称:,代码行数:20,代码来源:

示例15: test_upload

    def test_upload(self):
        options = MockOptions()
        options.cc = None
        options.check_style = True
        options.comment = None
        options.description = "MOCK description"
        options.request_commit = False
        options.review = True
        options.suggest_reviewers = False
        expected_stderr = """MOCK: user.open_url: file://...
Was that diff correct?
Obsoleting 2 old patches on bug 42
MOCK add_patch_to_bug: bug_id=42, description=MOCK description, mark_for_review=True, mark_for_commit_queue=False, mark_for_landing=False
MOCK: user.open_url: http://example.com/42
"""
        self.assert_execute_outputs(Upload(), [42], options=options, expected_stderr=expected_stderr)
开发者ID:0x4d52,项目名称:JavaScriptCore-X,代码行数:16,代码来源:upload_unittest.py


注:本文中的webkitpy.tool.mocktool.MockOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。