コード例 #1
0
def test_macOS_version_detection(monkeypatch):
    if platform.system() != "Darwin":
        monkeypatch.setattr(
            platform, "mac_ver", lambda: ("10.14", ("", "", ""), "x86_64")
        )
    version = platform.mac_ver()[0].split(".")
    expected = "macosx_{major}_{minor}".format(major=version[0], minor=version[1])
    platforms = pep425._mac_platforms(arch="x86_64")
    assert platforms[0].startswith(expected)
コード例 #2
0
def test_mac_platforms():
    platforms = pep425._mac_platforms((10, 5), "x86_64")
    assert platforms == [
        "macosx_10_5_x86_64",
        "macosx_10_5_intel",
        "macosx_10_5_fat64",
        "macosx_10_5_fat32",
        "macosx_10_5_universal",
        "macosx_10_4_x86_64",
        "macosx_10_4_intel",
        "macosx_10_4_fat64",
        "macosx_10_4_fat32",
        "macosx_10_4_universal",
    ]

    assert len(pep425._mac_platforms((10, 17), "x86_64")) == 14 * 5

    assert not pep425._mac_platforms((10, 0), "x86_64")
コード例 #3
0
def test_sys_tags_on_mac_pypy(monkeypatch):
    if platform.python_implementation() != "PyPy":
        monkeypatch.setattr(platform, "python_implementation", lambda: "PyPy")
        monkeypatch.setattr(pep425, "_pypy_interpreter", lambda: "pp360")
    if platform.system() != "Darwin":
        monkeypatch.setattr(pep425, "_mac_platforms", lambda: ["macosx_10_5_x86_64"])
    interpreter = pep425._pypy_interpreter()
    abi = pep425._generic_abi()
    platforms = pep425._mac_platforms()
    tags = list(pep425.sys_tags())
    assert tags[0] == pep425.Tag(interpreter, abi, platforms[0])
    assert tags[-1] == pep425.Tag("py{}0".format(sys.version_info[0]), "none", "any")
コード例 #4
0
def test_sys_tags_on_mac_cpython(monkeypatch):
    if platform.python_implementation() != "CPython":
        monkeypatch.setattr(platform, "python_implementation", lambda: "CPython")
        monkeypatch.setattr(pep425, "_cpython_abi", lambda py_version: "cp33m")
    if platform.system() != "Darwin":
        monkeypatch.setattr(pep425, "_mac_platforms", lambda: ["macosx_10_5_x86_64"])
    abi = pep425._cpython_abi(sys.version_info[:2])
    platforms = pep425._mac_platforms()
    tags = list(pep425.sys_tags())
    assert tags[0] == pep425.Tag(
        "cp{major}{minor}".format(major=sys.version_info[0], minor=sys.version_info[1]),
        abi,
        platforms[0],
    )
    assert tags[-1] == pep425.Tag("py{}0".format(sys.version_info[0]), "none", "any")
コード例 #5
0
def test_macOS_arch_detection(arch, monkeypatch):
    if platform.system() != "Darwin" or platform.mac_ver()[2] != arch:
        monkeypatch.setattr(platform, "mac_ver", lambda: ("10.14", ("", "", ""), arch))
    assert pep425._mac_platforms((10, 14))[0].endswith(arch)