diff options
| author | Bernát Gábor <bgabor8@bloomberg.net> | 2020-05-02 21:34:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-02 21:34:24 +0100 |
| commit | 481e395484b03cf24761f23ac76bfe8236704b1e (patch) | |
| tree | c5f16c8c6cafeb935e469ddbb79b65bbc5f419ab /tests/unit | |
| parent | 77f956e7d7072c3dfad8908204812baef9de93c4 (diff) | |
| download | virtualenv-481e395484b03cf24761f23ac76bfe8236704b1e.tar.gz | |
Fix CPython2 not found on Windows via registry (#1797)
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/create/test_creator.py | 2 | ||||
| -rw-r--r-- | tests/unit/discovery/windows/test_windows_pep514.py | 40 | ||||
| -rw-r--r-- | tests/unit/discovery/windows/winreg-mock-values.py | 16 | ||||
| -rw-r--r-- | tests/unit/seed/test_extra_install.py | 7 |
4 files changed, 33 insertions, 32 deletions
diff --git a/tests/unit/create/test_creator.py b/tests/unit/create/test_creator.py index af88adb..01944ad 100644 --- a/tests/unit/create/test_creator.py +++ b/tests/unit/create/test_creator.py @@ -330,8 +330,6 @@ def cross_python(is_inside_ci, session_app_data): @pytest.mark.slow def test_cross_major(cross_python, coverage_env, tmp_path, session_app_data, current_fastest): cmd = [ - "-v", - "-v", "-p", ensure_text(cross_python.executable), ensure_text(str(tmp_path)), diff --git a/tests/unit/discovery/windows/test_windows_pep514.py b/tests/unit/discovery/windows/test_windows_pep514.py index 9fbe04c..ab14d85 100644 --- a/tests/unit/discovery/windows/test_windows_pep514.py +++ b/tests/unit/discovery/windows/test_windows_pep514.py @@ -17,16 +17,16 @@ def test_pep514(_mock_registry): interpreters = list(discover_pythons()) assert interpreters == [ - ("ContinuumAnalytics", 3, 7, 32, "C:\\Users\\traveler\\Miniconda3\\python.exe", None), - ("ContinuumAnalytics", 3, 7, 64, "C:\\Users\\traveler\\Miniconda3-64\\python.exe", None), - ("python", 3, 6, 64, "C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", None), - ("python", 3, 6, 64, "C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", None), - ("python", 3, 5, 64, "C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python35\\python.exe", None), - ("python", 3, 6, 64, "C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", None), - ("python", 3, 7, 32, "C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe", None), - ("python", 3, 9, 64, "C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", None), - ("python", 2, 7, 64, "C:\\Python27\\python.exe", None), - ("python", 3, 4, 64, "C:\\Python34\\python.exe", None), + ("ContinuumAnalytics", 3, 7, 32, "C:\\Users\\user\\Miniconda3\\python.exe", None), + ("ContinuumAnalytics", 3, 7, 64, "C:\\Users\\user\\Miniconda3-64\\python.exe", None), + ("PythonCore", 3, 6, 64, "C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", None), + ("PythonCore", 3, 6, 64, "C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", None), + ("PythonCore", 3, 5, 64, "C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python35\\python.exe", None), + ("PythonCore", 3, 6, 64, "C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", None), + ("PythonCore", 3, 7, 32, "C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe", None), + ("PythonCore", 3, 9, 64, "C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", None), + ("PythonCore", 2, 7, 64, "C:\\Python27\\python.exe", None), + ("PythonCore", 3, 4, 64, "C:\\Python34\\python.exe", None), ] @@ -38,16 +38,16 @@ def test_pep514_run(_mock_registry, capsys, caplog): out, err = capsys.readouterr() expected = textwrap.dedent( r""" - ('ContinuumAnalytics', 3, 7, 32, 'C:\\Users\\traveler\\Miniconda3\\python.exe', None) - ('ContinuumAnalytics', 3, 7, 64, 'C:\\Users\\traveler\\Miniconda3-64\\python.exe', None) - ('python', 2, 7, 64, 'C:\\Python27\\python.exe', None) - ('python', 3, 4, 64, 'C:\\Python34\\python.exe', None) - ('python', 3, 5, 64, 'C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python35\\python.exe', None) - ('python', 3, 6, 64, 'C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python36\\python.exe', None) - ('python', 3, 6, 64, 'C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python36\\python.exe', None) - ('python', 3, 6, 64, 'C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python36\\python.exe', None) - ('python', 3, 7, 32, 'C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe', None) - ('python', 3, 9, 64, 'C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python36\\python.exe', None) + ('ContinuumAnalytics', 3, 7, 32, 'C:\\Users\\user\\Miniconda3\\python.exe', None) + ('ContinuumAnalytics', 3, 7, 64, 'C:\\Users\\user\\Miniconda3-64\\python.exe', None) + ('PythonCore', 2, 7, 64, 'C:\\Python27\\python.exe', None) + ('PythonCore', 3, 4, 64, 'C:\\Python34\\python.exe', None) + ('PythonCore', 3, 5, 64, 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python35\\python.exe', None) + ('PythonCore', 3, 6, 64, 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36\\python.exe', None) + ('PythonCore', 3, 6, 64, 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36\\python.exe', None) + ('PythonCore', 3, 6, 64, 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36\\python.exe', None) + ('PythonCore', 3, 7, 32, 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe', None) + ('PythonCore', 3, 9, 64, 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36\\python.exe', None) """ ).strip() assert out.strip() == expected diff --git a/tests/unit/discovery/windows/winreg-mock-values.py b/tests/unit/discovery/windows/winreg-mock-values.py index 5426ccb..bd832a5 100644 --- a/tests/unit/discovery/windows/winreg-mock-values.py +++ b/tests/unit/discovery/windows/winreg-mock-values.py @@ -46,22 +46,22 @@ key_open = { value_collect = { 78703568: {"SysVersion": ("3.7", 1), "SysArchitecture": ("32bit", 1)}, 78703200: { - "ExecutablePath": ("C:\\Users\\traveler\\Miniconda3\\python.exe", 1), + "ExecutablePath": ("C:\\Users\\user\\Miniconda3\\python.exe", 1), "ExecutableArguments": OSError(2, "The system cannot find the file specified"), }, 78702368: {"SysVersion": ("3.7", 1), "SysArchitecture": ("64bit", 1)}, 78703520: { - "ExecutablePath": ("C:\\Users\\traveler\\Miniconda3-64\\python.exe", 1), + "ExecutablePath": ("C:\\Users\\user\\Miniconda3-64\\python.exe", 1), "ExecutableArguments": OSError(2, "The system cannot find the file specified"), }, 78700704: {"SysVersion": ("3.6", 1), "SysArchitecture": ("magic", 1)}, 78701824: { - "ExecutablePath": ("C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", 1), + "ExecutablePath": ("C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", 1), "ExecutableArguments": OSError(2, "The system cannot find the file specified"), }, 78704368: {"SysVersion": ("3.6", 1), "SysArchitecture": (100, 4)}, 78704048: { - "ExecutablePath": ("C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", 1), + "ExecutablePath": ("C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", 1), "ExecutableArguments": OSError(2, "The system cannot find the file specified"), }, 78703024: {"SysVersion": ("3.6", 1), "SysArchitecture": ("64bit", 1)}, @@ -74,17 +74,17 @@ value_collect = { "SysArchitecture": OSError(2, "The system cannot find the file specified"), }, 78703792: { - "ExecutablePath": ("C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python35\\python.exe", 1), + "ExecutablePath": ("C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python35\\python.exe", 1), "ExecutableArguments": OSError(2, "The system cannot find the file specified"), }, 78703424: {"SysVersion": ("3.6", 1), "SysArchitecture": ("64bit", 1)}, 78701888: { - "ExecutablePath": ("C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", 1), + "ExecutablePath": ("C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", 1), "ExecutableArguments": OSError(2, "The system cannot find the file specified"), }, 78704512: {"SysVersion": ("3.7", 1), "SysArchitecture": ("32bit", 1)}, 78703600: { - "ExecutablePath": ("C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe", 1), + "ExecutablePath": ("C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe", 1), "ExecutableArguments": OSError(2, "The system cannot find the file specified"), }, 78700656: { @@ -93,7 +93,7 @@ value_collect = { }, 78702608: {"SysVersion": ("magic", 1), "SysArchitecture": ("64bit", 1)}, 78703632: { - "ExecutablePath": ("C:\\Users\\traveler\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", 1), + "ExecutablePath": ("C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36\\python.exe", 1), "ExecutableArguments": OSError(2, "The system cannot find the file specified"), }, 78703088: {"SysVersion": (2778, 11)}, diff --git a/tests/unit/seed/test_extra_install.py b/tests/unit/seed/test_extra_install.py index dd3bc23..115c9e1 100644 --- a/tests/unit/seed/test_extra_install.py +++ b/tests/unit/seed/test_extra_install.py @@ -1,6 +1,7 @@ from __future__ import absolute_import, unicode_literals import os +import shutil import subprocess import pytest @@ -36,7 +37,9 @@ def builtin_shows_marker_missing(): ) @pytest.mark.parametrize("creator", list(i for i in CREATOR_CLASSES.keys() if i != "builtin")) def test_can_build_c_extensions(creator, tmp_path, coverage_env): - session = cli_run(["--creator", creator, "--seed", "app-data", str(tmp_path), "-vvv"]) + env, greet = tmp_path / "env", str(tmp_path / "greet") + shutil.copytree(str(Path(__file__).parent.resolve() / "greet"), greet) + session = cli_run(["--creator", creator, "--seed", "app-data", str(env), "-vvv"]) coverage_env() cmd = [ str(session.creator.script("pip")), @@ -45,7 +48,7 @@ def test_can_build_c_extensions(creator, tmp_path, coverage_env): "--no-deps", "--disable-pip-version-check", "-vvv", - str(Path(__file__).parent.resolve() / "greet"), + greet, ] process = Popen(cmd) process.communicate() |
