本文整理汇总了Python中webkitpy.common.system.filesystem_mock.MockFileSystem.join方法的典型用法代码示例。如果您正苦于以下问题:Python MockFileSystem.join方法的具体用法?Python MockFileSystem.join怎么用?Python MockFileSystem.join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webkitpy.common.system.filesystem_mock.MockFileSystem
的用法示例。
在下文中一共展示了MockFileSystem.join方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_additional_platform_directory
# 需要导入模块: from webkitpy.common.system.filesystem_mock import MockFileSystem [as 别名]
# 或者: from webkitpy.common.system.filesystem_mock.MockFileSystem import join [as 别名]
def test_additional_platform_directory(self):
filesystem = MockFileSystem()
options, args = optparse.OptionParser().parse_args([])
port = base.Port(port_name='foo', filesystem=filesystem, options=options)
port.baseline_search_path = lambda: ['LayoutTests/platform/foo']
layout_test_dir = port.layout_tests_dir()
test_file = filesystem.join(layout_test_dir, 'fast', 'test.html')
# No additional platform directory
self.assertEqual(
port.expected_baselines(test_file, '.txt'),
[(None, 'fast/test-expected.txt')])
self.assertEqual(port.baseline_path(), 'LayoutTests/platform/foo')
# Simple additional platform directory
options.additional_platform_directory = ['/tmp/local-baselines']
filesystem.files = {
'/tmp/local-baselines/fast/test-expected.txt': 'foo',
}
self.assertEqual(
port.expected_baselines(test_file, '.txt'),
[('/tmp/local-baselines', 'fast/test-expected.txt')])
self.assertEqual(port.baseline_path(), '/tmp/local-baselines')
# Multiple additional platform directories
options.additional_platform_directory = ['/foo', '/tmp/local-baselines']
self.assertEqual(
port.expected_baselines(test_file, '.txt'),
[('/tmp/local-baselines', 'fast/test-expected.txt')])
self.assertEqual(port.baseline_path(), '/foo')
示例2: test_collect_tests
# 需要导入模块: from webkitpy.common.system.filesystem_mock import MockFileSystem [as 别名]
# 或者: from webkitpy.common.system.filesystem_mock.MockFileSystem import join [as 别名]
def test_collect_tests(self):
runner = self.create_runner()
runner._base_path = '/test.checkout/PerformanceTests'
filesystem = MockFileSystem()
filename = filesystem.join(runner._base_path, 'inspector', 'a_file.html')
filesystem.maybe_make_directory(runner._base_path, 'inspector')
filesystem.files[filename] = 'a content'
runner._host.filesystem = filesystem
tests = runner._collect_tests()
self.assertEqual(len(tests), 1)
示例3: get_test_config
# 需要导入模块: from webkitpy.common.system.filesystem_mock import MockFileSystem [as 别名]
# 或者: from webkitpy.common.system.filesystem_mock.MockFileSystem import join [as 别名]
def get_test_config(test_files=[], result_files=[]):
# We could grab this from port.layout_tests_dir(), but instantiating a fully mocked port is a pain.
layout_tests_directory = "/mock-checkout/LayoutTests"
results_directory = '/WebKitBuild/Debug/layout-test-results'
mock_filesystem = MockFileSystem()
for file in test_files:
file_path = mock_filesystem.join(layout_tests_directory, file)
mock_filesystem.files[file_path] = ''
for file in result_files:
file_path = mock_filesystem.join(results_directory, file)
mock_filesystem.files[file_path] = ''
class TestMacPort(WebKitPort):
port_name = "mac"
def __init__(self):
WebKitPort.__init__(self, filesystem=mock_filesystem, host=MockHost())
return TestConfig(
TestMacPort(),
layout_tests_directory,
results_directory,
('mac', 'mac-leopard', 'win', 'linux'),
mock_filesystem,
MockSCM())
示例4: HttpLockTest
# 需要导入模块: from webkitpy.common.system.filesystem_mock import MockFileSystem [as 别名]
# 或者: from webkitpy.common.system.filesystem_mock.MockFileSystem import join [as 别名]
class HttpLockTest(unittest.TestCase):
def setUp(self):
self.filesystem = MockFileSystem()
self.http_lock = HttpLock(
None, "WebKitTestHttpd.lock.", "WebKitTest.lock", filesystem=self.filesystem, executive=MockExecutive()
)
# FIXME: Shouldn't we be able to get these values from the http_lock object directly?
self.lock_file_path_prefix = self.filesystem.join(self.http_lock._lock_path, self.http_lock._lock_file_prefix)
self.lock_file_name = self.lock_file_path_prefix + "0"
def test_current_lock_pid(self):
# FIXME: Once Executive wraps getpid, we can mock this and not use a real pid.
current_pid = os.getpid()
self.http_lock._filesystem.write_text_file(self.lock_file_name, str(current_pid))
self.assertEqual(self.http_lock._current_lock_pid(), current_pid)
def test_extract_lock_number(self):
lock_file_list = (
self.lock_file_path_prefix + "00",
self.lock_file_path_prefix + "9",
self.lock_file_path_prefix + "001",
self.lock_file_path_prefix + "021",
)
expected_number_list = (0, 9, 1, 21)
for lock_file, expected in zip(lock_file_list, expected_number_list):
self.assertEqual(self.http_lock._extract_lock_number(lock_file), expected)
def test_lock_file_list(self):
self.http_lock._filesystem = MockFileSystem(
{
self.lock_file_path_prefix + "6": "",
self.lock_file_path_prefix + "1": "",
self.lock_file_path_prefix + "4": "",
self.lock_file_path_prefix + "3": "",
}
)
expected_file_list = [
self.lock_file_path_prefix + "1",
self.lock_file_path_prefix + "3",
self.lock_file_path_prefix + "4",
self.lock_file_path_prefix + "6",
]
self.assertEqual(self.http_lock._lock_file_list(), expected_file_list)
示例5: test_additional_platform_directory
# 需要导入模块: from webkitpy.common.system.filesystem_mock import MockFileSystem [as 别名]
# 或者: from webkitpy.common.system.filesystem_mock.MockFileSystem import join [as 别名]
def test_additional_platform_directory(self):
filesystem = MockFileSystem()
options, args = optparse.OptionParser().parse_args([])
port = base.Port(port_name="foo", filesystem=filesystem, options=options)
port.baseline_search_path = lambda: []
layout_test_dir = port.layout_tests_dir()
test_file = filesystem.join(layout_test_dir, "fast", "test.html")
# No additional platform directory
self.assertEqual(port.expected_baselines(test_file, ".txt"), [(None, "fast/test-expected.txt")])
# Simple additional platform directory
options.additional_platform_directory = ["/tmp/local-baselines"]
filesystem.files = {"/tmp/local-baselines/fast/test-expected.txt": "foo"}
self.assertEqual(
port.expected_baselines(test_file, ".txt"), [("/tmp/local-baselines", "fast/test-expected.txt")]
)
# Multiple additional platform directories
options.additional_platform_directory = ["/foo", "/tmp/local-baselines"]
self.assertEqual(
port.expected_baselines(test_file, ".txt"), [("/tmp/local-baselines", "fast/test-expected.txt")]
)