Exemple #1
0
    def test_system_memory_darwin_platform_when_sysctl_fails(self):
        with mock.patch.object(shell, 'check_output') as mock_check_output:
            mock_check_output.side_effect = shell.CalledProcessError(
                returncode=1,
                cmd=['sysctl', 'hw.memsize'])

            self.assertIsNone(defaults._system_memory())
Exemple #2
0
    def test_version_error_returns_none(self):
        with mock.patch('build_swift.shell.check_output') as check_output:
            check_output.side_effect = shell.CalledProcessError(-1, None)

            result = self.xcrun.version

        check_output.assert_called_with([self.xcrun.EXECUTABLE, '--version'])
        self.assertIsNone(result)
    def test_sdk_platform_version_unknown_sdk(self):
        with mock.patch('build_swift.shell.check_output') as check_output:
            check_output.side_effect = shell.CalledProcessError(-1, None)

            result = self.xcrun.sdk_platform_version(sdk=_UNKNOWN_SDK)

        command = [
            self.xcrun.EXECUTABLE,
            '--sdk', _UNKNOWN_SDK,
            '--show-sdk-platform-version',
        ]

        check_output.assert_called_with(command, stderr=shell.DEVNULL)
        self.assertIsNone(result)
    def test_find_missing_tool(self):
        with mock.patch('build_swift.shell.check_output') as check_output:
            check_output.side_effect = shell.CalledProcessError(-1, None)

            result = self.xcrun.find(_UNKNOWN_TOOL, sdk=_KNOWN_SDK)

        command = [
            self.xcrun.EXECUTABLE,
            '--sdk', _KNOWN_SDK,
            '--find', _UNKNOWN_TOOL,
        ]

        check_output.assert_called_with(command, stderr=shell.DEVNULL)
        self.assertIsNone(result)