Пример #1
0
def test_2_exe_on_default_py_host(py_info, mock_files):
    mock_files(CPYTHON3_PATH, [py_info.system_executable])
    sources = tuple(CPython3Windows.sources(interpreter=py_info))
    # Default Python exe.
    assert contains_exe(sources, py_info.system_executable)
    # Should always exist.
    assert contains_exe(sources, path(py_info.prefix, "pythonw.exe"))
Пример #2
0
def test_3_exe_on_not_default_py_host(py_info, mock_files):
    # Not default python host.
    py_info.system_executable = path(py_info.prefix, "python666.exe")
    mock_files(CPYTHON3_PATH, [py_info.system_executable])
    sources = tuple(CPython3Windows.sources(interpreter=py_info))
    # Not default Python exe linked to both the default name and origin.
    assert contains_exe(sources, py_info.system_executable, "python.exe")
    assert contains_exe(sources, py_info.system_executable, "python666.exe")
    # Should always exist.
    assert contains_exe(sources, path(py_info.prefix, "pythonw.exe"))
Пример #3
0
def test_only_shim(py_info, mock_files):
    shim = path(py_info.system_stdlib, "venv\\scripts\\nt\\python.exe")
    py_files = (
        path(py_info.prefix, "libcrypto-1_1.dll"),
        path(py_info.prefix, "libffi-7.dll"),
        path(py_info.prefix, "_asyncio.pyd"),
        path(py_info.prefix, "_bz2.pyd"),
    )
    mock_files(CPYTHON3_PATH, [shim, *py_files])
    sources = tuple(CPython3Windows.sources(interpreter=py_info))
    assert CPython3Windows.has_shim(interpreter=py_info)
    assert contains_exe(sources, shim)
    assert not contains_exe(sources, py_info.system_executable)
    for file in py_files:
        assert not contains_ref(sources, file)
Пример #4
0
def test_debian_pypy38_virtualenvs_exclude_usr(py_info, mock_files,
                                               mock_pypy_libs):
    mock_files(PYPY3_PATH, [py_info.system_executable, "/usr/lib/foo"])
    # libpypy3-c.so lives on the ld search path
    mock_pypy_libs(PyPy3Posix, [])
    sources = tuple(PyPy3Posix.sources(interpreter=py_info))
    assert len(sources) == 1
    assert contains_exe(sources, py_info.system_executable)
Пример #5
0
def test_debian_pypy37_virtualenvs(py_info, mock_files, mock_pypy_libs):
    # Debian's pypy3 layout, installed to /usr, before 3.8 allowed a /usr prefix
    mock_files(PYPY3_PATH, [py_info.system_executable])
    lib_file = path(py_info.prefix, "bin/libpypy3-c.so")
    mock_pypy_libs(PyPy3Posix, [lib_file])
    sources = tuple(PyPy3Posix.sources(interpreter=py_info))
    assert len(sources) == 2
    assert contains_exe(sources, py_info.system_executable)
    assert contains_ref(sources, lib_file)
Пример #6
0
def test_portable_pypy3_virtualenvs_get_their_libs(py_info, mock_files,
                                                   mock_pypy_libs):
    py_file = path(py_info.prefix, "lib/libgdbm.so.4")
    mock_files(PYPY3_PATH, [py_info.system_executable, py_file])
    lib_file = path(py_info.prefix, "bin/libpypy3-c.so")
    mock_pypy_libs(PyPy3Posix, [lib_file])
    sources = tuple(PyPy3Posix.sources(interpreter=py_info))
    assert len(sources) > 2
    assert contains_exe(sources, py_info.system_executable)
    assert contains_ref(sources, py_file)
    assert contains_ref(sources, lib_file)
Пример #7
0
def test_exe_dll_pyd_without_shim(py_info, mock_files):
    py_files = (
        path(py_info.prefix, "libcrypto-1_1.dll"),
        path(py_info.prefix, "libffi-7.dll"),
        path(py_info.prefix, "_asyncio.pyd"),
        path(py_info.prefix, "_bz2.pyd"),
    )
    mock_files(CPYTHON3_PATH, py_files)
    sources = tuple(CPython3Windows.sources(interpreter=py_info))
    assert not CPython3Windows.has_shim(interpreter=py_info)
    assert contains_exe(sources, py_info.system_executable)
    for file in py_files:
        assert contains_ref(sources, file)