Esempio n. 1
0
def test_cpython_abi_py3(monkeypatch):
    if platform.python_implementation(
    ) != "CPython" or not sysconfig.get_config_var("SOABI"):
        monkeypatch.setattr(sysconfig, "get_config_var",
                            lambda key: "'cpython-37m-darwin'")
    _, soabi, _ = sysconfig.get_config_var("SOABI").split("-", 2)
    assert "cp{soabi}".format(soabi=soabi) == pep425._cpython_abi(
        sys.version_info[:2])
Esempio n. 2
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")
Esempio n. 3
0
def test_cpython_abi_py2(debug, pymalloc, unicode_width, monkeypatch):
    if platform.python_implementation() != "CPython" or sysconfig.get_config_var(
        "SOABI"
    ):
        if debug != sysconfig.get_config_var("Py_DEBUG") or pymalloc != sysconfig.get_config_var("WITH_PYMALLOC") or sysconfig.get_config_var("Py_UNICODE_SIZE") != unicode_width:
            config_vars = {"SOABI": None, "Py_DEBUG": int(debug), "WITH_PYMALLOC": int(pymalloc), "Py_UNICODE_SIZE": unicode_width}
            monkeypatch.setattr(sysconfig, "get_config_var", config_vars.__getitem__)
        options = ""
        if debug:
            options += "d"
        if pymalloc:
            options += "m"
        if unicode_width == 4:
            options += "u"
        assert "cp33{}".format(options) == pep425._cpython_abi((3, 3))