Commit 96bc4ee3 by Sébastien Eustace

Fix tests on windows

parent 041e10f7
......@@ -4,7 +4,6 @@ from pathlib import Path
import pytest
from poetry.utils._compat import WINDOWS
from poetry.utils.env import MockEnv
......@@ -45,7 +44,7 @@ Executable: {base_executable}
base_prefix=str(Path("/base/prefix")),
base_version=".".join(str(v) for v in sys.version_info[:3]),
executable=sys.executable,
base_executable="python" + (".exe" if WINDOWS else ""),
base_executable="python",
)
assert expected == tester.io.fetch_output()
......
......@@ -1001,7 +1001,7 @@ def test_env_finds_the_correct_executables(tmp_dir, manager):
venv = VirtualEnv(venv_path)
assert Path(venv.python).name == expected_executable
assert Path(venv.pip).name == expected_pip_executable
assert Path(venv.pip).name.startswith(expected_pip_executable.split(".")[0])
def test_env_finds_the_correct_executables_for_generic_env(tmp_dir, manager):
......@@ -1021,6 +1021,10 @@ def test_env_finds_the_correct_executables_for_generic_env(tmp_dir, manager):
sys.version_info[0], sys.version_info[1], ".exe" if WINDOWS else ""
)
if WINDOWS:
expected_executable = "python.exe"
expected_pip_executable = "pip.exe"
assert Path(venv.python).name == expected_executable
assert Path(venv.pip).name == expected_pip_executable
......@@ -1079,6 +1083,12 @@ def test_env_finds_fallback_executables_for_generic_env(tmp_dir, manager):
venv._bin_dir.joinpath(expected_pip_executable).unlink()
expected_pip_executable = default_pip_executable
if not venv._bin_dir.joinpath(expected_executable).exists():
expected_executable = default_executable
if not venv._bin_dir.joinpath(expected_pip_executable).exists():
expected_pip_executable = default_pip_executable
venv = GenericEnv(parent_venv.path, child_env=VirtualEnv(child_venv_path))
assert Path(venv.python).name == expected_executable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment