コード例 #1
0
    def assertVersionLess(self, v1, v2):
        v1 = Version(v1)
        v2 = Version(v2)

        self.assertLess(v1, v2)
        self.assertGreater(v2, v1)
        self.assertNotEqual(v1, v2)
コード例 #2
0
ファイル: test_xcrun.py プロジェクト: askar1680/AlfaTechTalk
    def test_version(self):
        with mock.patch('build_swift.shell.check_output') as check_output:
            check_output.return_value = 'xcrun version 42.\n'

            result = self.xcrun.version

        check_output.assert_called_with([self.xcrun.EXECUTABLE, '--version'])
        self.assertEqual(result, Version('42'))
コード例 #3
0
ファイル: utils.py プロジェクト: YOCKOW/swift
def requires_python(version):
    """Decorator used to skip tests if the running Python version is not
    greater or equal to the required version.
    """

    if isinstance(version, str):
        version = Version(version)

    if _PYTHON_VERSION >= version:
        return lambda func: func

    return unittest.skip(
        'Requires Python version {} or greater'.format(version))
コード例 #4
0
ファイル: test_xcrun.py プロジェクト: nickolas-pohilets/swift
    def test_sdk_build_version_known_sdk(self):
        with mock.patch('build_swift.shell.check_output') as check_output:
            check_output.return_value = '{}\n'.format(_KNOWN_SDK_BUILD_VERSION)

            result = self.xcrun.sdk_build_version(sdk=_KNOWN_SDK)

        command = [
            self.xcrun.EXECUTABLE,
            '--sdk', _KNOWN_SDK,
            '--show-sdk-build-version',
        ]

        check_output.assert_called_with(command, stderr=shell.DEVNULL)
        self.assertEqual(result, Version(_KNOWN_SDK_BUILD_VERSION))
コード例 #5
0
ファイル: utils.py プロジェクト: YOCKOW/swift
from build_swift.versions import Version

__all__ = [
    'quiet_output',
    'redirect_stderr',
    'redirect_stdout',
    'requires_attr',
    'requires_module',
    'requires_platform',
    'requires_python',
]

# -----------------------------------------------------------------------------
# Constants

_PYTHON_VERSION = Version(platform.python_version())

# -----------------------------------------------------------------------------
# Helpers


def _can_import(fullname):
    try:
        __import__(fullname)
        return True
    except ImportError:
        return False


# -----------------------------------------------------------------------------
コード例 #6
0
    def test_str(self):
        for string in self.VERSION_COMPONENTS.keys():
            version = Version(string)

            self.assertEqual(str(version), string)
コード例 #7
0
    def test_parse(self):
        for string, components in self.VERSION_COMPONENTS.items():
            # Version parses
            version = Version(string)

            self.assertEqual(version.components, components)
コード例 #8
0
    def assertVersionNotEqual(self, v1, v2):
        v1 = Version(v1)
        v2 = Version(v2)

        self.assertNotEqual(v1, v2)
        self.assertNotEqual(v2, v1)
コード例 #9
0
    def test_str(self):
        for string in six.iterkeys(self.VERSION_COMPONENTS):
            version = Version(string)

            self.assertEqual(six.text_type(version), string)