def __init__(self, options, interpreter):
     self.describe = options.describe
     super(Venv, self).__init__(options, interpreter)
     self.can_be_inline = (
         interpreter is PythonInfo.current() and interpreter.executable == interpreter.system_executable
     )
     self._context = None
示例#2
0
def skip_if_test_in_system(session_app_data):
    current = PythonInfo.current(session_app_data)
    if current.system_executable is not None:
        pytest.skip("test not valid if run under system")
示例#3
0
from __future__ import absolute_import, unicode_literals

import logging
import os

import pytest

from virtualenv.discovery.py_info import EXTENSIONS, PythonInfo
from virtualenv.info import IS_WIN, fs_is_case_sensitive, fs_supports_symlink
from virtualenv.util.path import Path

CURRENT = PythonInfo.current()


def test_discover_empty_folder(tmp_path, monkeypatch, session_app_data):
    with pytest.raises(RuntimeError):
        CURRENT.discover_exe(session_app_data, prefix=str(tmp_path))


BASE = (CURRENT.distutils_install["scripts"], ".")


@pytest.mark.skipif(not fs_supports_symlink(), reason="symlink is not supported")
@pytest.mark.parametrize("suffix", sorted({".exe", ".cmd", ""} & set(EXTENSIONS) if IS_WIN else [""]))
@pytest.mark.parametrize("into", BASE)
@pytest.mark.parametrize("arch", [CURRENT.architecture, ""])
@pytest.mark.parametrize("version", [".".join(str(i) for i in CURRENT.version_info[0:i]) for i in range(3, 0, -1)])
@pytest.mark.parametrize("impl", [CURRENT.implementation, "python"])
def test_discover_ok(tmp_path, monkeypatch, suffix, impl, version, arch, into, caplog, session_app_data):
    caplog.set_level(logging.DEBUG)
    folder = tmp_path / into
示例#4
0
 def __init__(self, options, interpreter):
     self.describe = options.describe
     super().__init__(options, interpreter)
     current = PythonInfo.current()
     self.can_be_inline = interpreter is current and interpreter.executable == interpreter.system_executable
     self._context = None