def __init__(self, log_executive=False, executive_throws_when_run=None, os_name=None, os_version=None, executive=None, filesystem=None, time_return_val=123): self.executable = 'python' self.executive = executive or MockExecutive( should_log=log_executive, should_throw_when_run=executive_throws_when_run) self.filesystem = filesystem or MockFileSystem() self.user = MockUser() self.platform = MockPlatformInfo() if os_name: self.platform.os_name = os_name if os_version: self.platform.os_version = os_version # FIXME: Should this take pointers to the filesystem and the executive? self.workspace = MockWorkspace() self.stdin = StringIO() self.stdout = StringIO() self.stderr = StringIO() self.environ = {'MOCK_ENVIRON_COPY': '1', 'PATH': '/bin:/mock/bin'} self.time_return_val = time_return_val
def __init__(self, log_executive=False, executive_throws_when_run=None, os_name=None, os_version=None, executive=None, filesystem=None): self.executable = 'python' self.executive = executive or MockExecutive( should_log=log_executive, should_throw_when_run=executive_throws_when_run) self.filesystem = filesystem or MockFileSystem() self.user = MockUser() self.platform = MockPlatformInfo() if os_name: self.platform.os_name = os_name if os_version: self.platform.os_version = os_version # FIXME: Should this take pointers to the filesystem and the executive? self.workspace = MockWorkspace() self.stdin = StringIO() self.stdout = StringIO() self.stderr = StringIO()
def __init__(self, log_executive=False, executive_throws_when_run=None): self.executive = MockExecutive( should_log=log_executive, should_throw_when_run=executive_throws_when_run) self.filesystem = MockFileSystem() self.user = MockUser() self.platform = MockPlatformInfo() # FIXME: Should this take pointers to the filesystem and the executive? self.workspace = MockWorkspace()
def test_rosetta_expectations(self): mock_host = MockSystemHost() mock_host.platform = MockPlatformInfo(architecture='arm64') mock_host.filesystem.write_text_file( '/mock-checkout/LayoutTests/platform/mac/TestExpectationsRosetta', '# FIXME <https://bugs.webkit.org/show_bug.cgi?id=213761>\n', ) port = self.make_port( host=mock_host, options=MockOptions(architecture='x86_64', configuration='Release'), ) self.assertEqual( list(port.expectations_dict().keys())[-1], '/mock-checkout/LayoutTests/platform/mac/TestExpectationsRosetta', )
def _assert_default_profiler_name(self, os_name, expected_profiler_name): profiler_name = ProfilerFactory.default_profiler_name( MockPlatformInfo(os_name)) self.assertEqual(profiler_name, expected_profiler_name)
def _assert_config_file_for_linux_distribution(self, port, distribution, config_file): port.host.platform = MockPlatformInfo(os_name='linux', linux_distribution=distribution) self.assertEqual(port._apache_config_file_name_for_platform(), config_file) # pylint: disable=protected-access
def _assert_config_file_for_platform(self, port, platform, config_file): port.host.platform = MockPlatformInfo(os_name=platform) self.assertEqual(port._apache_config_file_name_for_platform(), config_file) # pylint: disable=protected-access
def _assert_config_file_for_platform(self, port, platform, config_file): port.host.platform = MockPlatformInfo(os_name=platform) self.assertEqual(port._apache_config_file_name_for_platform(), config_file)
def test_abspath_to_uri_escaping_unixy(self): self.assertEqual( path.abspath_to_uri(MockPlatformInfo(), '/foo/bar + baz%?.html'), 'file:///foo/bar%20+%20baz%25%3F.html')
def test_abspath_to_uri_unixy(self): self.assertEqual( path.abspath_to_uri(MockPlatformInfo(), "/foo/bar.html"), 'file:///foo/bar.html')