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


Python MockTool.filesystem方法代码示例

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


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

示例1: test_missing_layout_test_results

# 需要导入模块: from webkitpy.tool.mocktool import MockTool [as 别名]
# 或者: from webkitpy.tool.mocktool.MockTool import filesystem [as 别名]
 def test_missing_layout_test_results(self):
     tool = MockTool()
     reader = LayoutTestResultsReader(tool, "/var/logs")
     results_path = '/mock-results/results.html'
     tool.filesystem = MockFileSystem({results_path: None})
     # Make sure that our filesystem mock functions as we expect.
     self.assertRaises(IOError, tool.filesystem.read_text_file, results_path)
     # layout_test_results shouldn't raise even if the results.html file is missing.
     self.assertEquals(reader.results(), None)
开发者ID:Andolamin,项目名称:LunaSysMgr,代码行数:11,代码来源:layouttestresultsreader_unittest.py

示例2: test_missing_layout_test_results

# 需要导入模块: from webkitpy.tool.mocktool import MockTool [as 别名]
# 或者: from webkitpy.tool.mocktool.MockTool import filesystem [as 别名]
 def test_missing_layout_test_results(self):
     queue = CommitQueue()
     tool = MockTool()
     results_path = '/mock/results.html'
     tool.filesystem = MockFileSystem({results_path: None})
     queue.bind_to_tool(tool)
     # Make sure that our filesystem mock functions as we expect.
     self.assertRaises(IOError, tool.filesystem.read_text_file, results_path)
     # layout_test_results shouldn't raise even if the results.html file is missing.
     self.assertEquals(queue.layout_test_results(), None)
开发者ID:0x4d52,项目名称:JavaScriptCore-X,代码行数:12,代码来源:queues_unittest.py

示例3: test_missing_layout_test_results

# 需要导入模块: from webkitpy.tool.mocktool import MockTool [as 别名]
# 或者: from webkitpy.tool.mocktool.MockTool import filesystem [as 别名]
 def test_missing_layout_test_results(self):
     tool = MockTool()
     reader = LayoutTestResultsReader(tool, "/var/logs")
     layout_tests_results_path = '/mock-results/full_results.json'
     unit_tests_results_path = '/mock-results/webkit_unit_tests_output.xml'
     tool.filesystem = MockFileSystem({layout_tests_results_path: None,
                                       unit_tests_results_path: None})
     # Make sure that our filesystem mock functions as we expect.
     self.assertRaises(IOError, tool.filesystem.read_text_file, layout_tests_results_path)
     self.assertRaises(IOError, tool.filesystem.read_text_file, unit_tests_results_path)
     # layout_test_results shouldn't raise even if the results.json file is missing.
     self.assertEqual(reader.results(), None)
开发者ID:,项目名称:,代码行数:14,代码来源:

示例4: test_create_unit_test_results

# 需要导入模块: from webkitpy.tool.mocktool import MockTool [as 别名]
# 或者: from webkitpy.tool.mocktool.MockTool import filesystem [as 别名]
    def test_create_unit_test_results(self):
        tool = MockTool()
        reader = LayoutTestResultsReader(tool, "/var/logs")
        unit_tests_results_path = '/mock-results/webkit_unit_tests_output.xml'
        no_failures_xml = """<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3" failures="0" disabled="0" errors="0" time="11.35" name="AllTests">
  <testsuite name="RenderTableCellDeathTest" tests="3" failures="0" disabled="0" errors="0" time="0.677">
    <testcase name="CanSetColumn" status="run" time="0.168" classname="RenderTableCellDeathTest" />
    <testcase name="CrashIfSettingUnsetColumnIndex" status="run" time="0.129" classname="RenderTableCellDeathTest" />
    <testcase name="CrashIfSettingUnsetRowIndex" status="run" time="0.123" classname="RenderTableCellDeathTest" />
  </testsuite>
</testsuites>"""
        tool.filesystem = MockFileSystem({unit_tests_results_path: no_failures_xml})
        self.assertEqual(reader._create_unit_test_results(), [])
开发者ID:twnin,项目名称:webkit,代码行数:16,代码来源:layouttestresultsreader_unittest.py

示例5: test_report_flaky_tests_creating_bug

# 需要导入模块: from webkitpy.tool.mocktool import MockTool [as 别名]
# 或者: from webkitpy.tool.mocktool.MockTool import filesystem [as 别名]
    def test_report_flaky_tests_creating_bug(self):
        tool = MockTool()
        tool.filesystem = MockFileSystem({"/mock-results/foo/bar-diffs.txt": "mock"})
        tool.status_server = MockStatusServer(bot_id="mock-bot-id")
        reporter = FlakyTestReporter(tool, 'dummy-queue')
        reporter._lookup_bug_for_flaky_test = lambda bug_id: None
        patch = tool.bugs.fetch_attachment(10000)
        expected_logs = """Bug does not already exist for foo/bar.html, creating.
MOCK create_bug
bug_title: Flaky Test: foo/bar.html
bug_description: This is an automatically generated bug from the dummy-queue.
foo/bar.html has been flaky on the dummy-queue.

foo/bar.html was authored by [email protected]
http://trac.webkit.org/browser/trunk/LayoutTests/foo/bar.html

The dummy-queue just saw foo/bar.html flake (text diff) while processing attachment 10000 on bug 50000.
Bot: mock-bot-id  Port: MockPort  Platform: MockPlatform 1.0

The bots will update this with information from each new failure.

If you believe this bug to be fixed or invalid, feel free to close.  The bots will re-open if the flake re-occurs.

If you would like to track this test fix with another bug, please close this bug as a duplicate.  The bots will follow the duplicate chain when making future comments.

component: Tools / Tests
cc: [email protected]
blocked: 50856
MOCK add_attachment_to_bug: bug_id=60001, description=Failure diff from mock-bot-id filename=failure.diff mimetype=None
MOCK bug comment: bug_id=50000, cc=None
--- Begin comment ---
The dummy-queue encountered the following flaky tests while processing attachment 10000:

foo/bar.html bug 60001 (author: [email protected])
The dummy-queue is continuing to process your patch.
--- End comment ---

"""
        test_results = [self._mock_test_result('foo/bar.html')]

        class MockZipFile(object):
            def read(self, path):
                return ""

            def namelist(self):
                return ['foo/bar-diffs.txt']

        OutputCapture().assert_outputs(self, reporter.report_flaky_tests, [patch, test_results, MockZipFile()], expected_logs=expected_logs)
开发者ID:EQ4,项目名称:h5vcc,代码行数:50,代码来源:flakytestreporter_unittest.py

示例6: test_archive_last_layout_test_results

# 需要导入模块: from webkitpy.tool.mocktool import MockTool [as 别名]
# 或者: from webkitpy.tool.mocktool.MockTool import filesystem [as 别名]
    def test_archive_last_layout_test_results(self):
        tool = MockTool()
        reader = LayoutTestResultsReader(tool, "/var/logs")
        patch = tool.bugs.fetch_attachment(10001)
        tool.filesystem = MockFileSystem()
        # Should fail because the results_directory does not exist.
        expected_stderr = "/mock-results does not exist, not archiving.\n"
        archive = OutputCapture().assert_outputs(self, reader.archive, [patch], expected_stderr=expected_stderr)
        self.assertEqual(archive, None)

        results_directory = "/mock-results"
        # Sanity check what we assume our mock results directory is.
        self.assertEqual(reader._results_directory(), results_directory)
        tool.filesystem.maybe_make_directory(results_directory)
        self.assertTrue(tool.filesystem.exists(results_directory))

        self.assertNotEqual(reader.archive(patch), None)
        self.assertFalse(tool.filesystem.exists(results_directory))
开发者ID:twnin,项目名称:webkit,代码行数:20,代码来源:layouttestresultsreader_unittest.py

示例7: test_report_flaky_tests_creating_bug

# 需要导入模块: from webkitpy.tool.mocktool import MockTool [as 别名]
# 或者: from webkitpy.tool.mocktool.MockTool import filesystem [as 别名]
    def test_report_flaky_tests_creating_bug(self):
        tool = MockTool()
        tool.filesystem = MockFileSystem({"/mock/foo/bar-diffs.txt": "mock"})
        tool.status_server = MockStatusServer(bot_id="mock-bot-id")
        reporter = FlakyTestReporter(tool, 'dummy-queue')
        reporter._lookup_bug_for_flaky_test = lambda bug_id: None
        patch = tool.bugs.fetch_attachment(197)
        expected_stderr = """MOCK create_bug
bug_title: Flaky Test: foo/bar.html
bug_description: This is an automatically generated bug from the dummy-queue.
foo/bar.html has been flaky on the dummy-queue.

foo/bar.html was authored by [email protected]
http://trac.webkit.org/browser/trunk/LayoutTests/foo/bar.html

The dummy-queue just saw foo/bar.html flake while processing attachment 197 on bug 42.
Bot: mock-bot-id  Port: MockPort  Platform: MockPlatform 1.0

The bots will update this with information from each new failure.

If you believe this bug to be fixed or invalid, feel free to close.  The bots will re-open if the flake re-occurs.

If you would like to track this test fix with another bug, please close this bug as a duplicate.  The bots will follow the duplicate chain when making future comments.

component: Tools / Tests
cc: [email protected]
blocked: 50856
MOCK add_attachment_to_bug: bug_id=78, description=Failure diff from mock-bot-id filename=failure.diff
MOCK bug comment: bug_id=42, cc=None
--- Begin comment ---
The dummy-queue encountered the following flaky tests while processing attachment 197:

foo/bar.html bug 78 (author: [email protected])
The dummy-queue is continuing to process your patch.
--- End comment ---

"""
        OutputCapture().assert_outputs(self, reporter.report_flaky_tests, [['foo/bar.html'], patch], expected_stderr=expected_stderr)
开发者ID:,项目名称:,代码行数:40,代码来源:


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