diff options
| author | Bernát Gábor <bgabor8@bloomberg.net> | 2020-09-10 19:29:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-10 19:29:25 +0100 |
| commit | 13c0498a47acf8a0aad6db9ceb1033dfe5f119a9 (patch) | |
| tree | 969e92eadfa4a2c8c96f373e0897a05fdb917769 /tests/unit/create | |
| parent | dc5eb79cfa64270af5dfe7980488b6abddfa8fef (diff) | |
| download | virtualenv-13c0498a47acf8a0aad6db9ceb1033dfe5f119a9.tar.gz | |
Upgrade setuptools and pip (#1939)
Diffstat (limited to 'tests/unit/create')
| -rw-r--r-- | tests/unit/create/conftest.py | 10 | ||||
| -rw-r--r-- | tests/unit/create/test_creator.py | 16 | ||||
| -rw-r--r-- | tests/unit/create/test_interpreters.py | 3 | ||||
| -rw-r--r-- | tests/unit/create/via_global_ref/greet/setup.py | 3 |
4 files changed, 24 insertions, 8 deletions
diff --git a/tests/unit/create/conftest.py b/tests/unit/create/conftest.py index f51dcc2..c709ade 100644 --- a/tests/unit/create/conftest.py +++ b/tests/unit/create/conftest.py @@ -14,6 +14,7 @@ import sys import pytest from virtualenv.discovery.py_info import PythonInfo +from virtualenv.info import IS_WIN from virtualenv.run import cli_run from virtualenv.util.path import Path from virtualenv.util.subprocess import Popen @@ -77,13 +78,20 @@ def old_virtualenv(tmp_path_factory, session_app_data): process = Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) _, __ = process.communicate() assert not process.returncode + if result.creator.interpreter.implementation == "PyPy" and IS_WIN: + # old virtualenv creates pypy paths wrong on windows, so have to hardcode it + return str(old_virtualenv_at / "bin" / "pypy.exe") exe_path = CURRENT.discover_exe(session_app_data, prefix=str(old_virtualenv_at)).original_executable return exe_path except Exception as exception: return RuntimeError("failed to create old virtualenv {}".format(exception)) -PYTHON = {"root": root, "venv": venv, "old_virtualenv": old_virtualenv} +PYTHON = { + "root": root, + "venv": venv, + "old_virtualenv": old_virtualenv, +} @pytest.fixture(params=list(PYTHON.values()), ids=list(PYTHON.keys()), scope="session") diff --git a/tests/unit/create/test_creator.py b/tests/unit/create/test_creator.py index 9e4bc82..68d64b0 100644 --- a/tests/unit/create/test_creator.py +++ b/tests/unit/create/test_creator.py @@ -169,7 +169,9 @@ def test_create_no_seed(python, creator, isolated, system, coverage_env, special # ensure all additional paths are related to the virtual environment for path in our_paths: msg = "\n{}\ndoes not start with {}\nhas:\n{}".format( - ensure_text(str(path)), ensure_text(str(dest)), "\n".join(ensure_text(str(p)) for p in system_sys_path), + ensure_text(str(path)), + ensure_text(str(dest)), + "\n".join(ensure_text(str(p)) for p in system_sys_path), ) assert str(path).startswith(str(dest)), msg # ensure there's at least a site-packages folder as part of the virtual environment added @@ -179,7 +181,8 @@ def test_create_no_seed(python, creator, isolated, system, coverage_env, special global_sys_path = system_sys_path[-1] if isolated == "isolated": msg = "global sys path {} is in virtual environment sys path:\n{}".format( - ensure_text(str(global_sys_path)), "\n".join(ensure_text(str(j)) for j in sys_path), + ensure_text(str(global_sys_path)), + "\n".join(ensure_text(str(j)) for j in sys_path), ) assert global_sys_path not in sys_path, msg else: @@ -409,7 +412,8 @@ def test_create_distutils_cfg(creator, tmp_path, monkeypatch, session_app_data): install_scripts={0}{1}scripts install_data={0}{1}data """.format( - tmp_path, os.sep, + tmp_path, + os.sep, ), ) setup_cfg.write_text(setup_cfg.read_text() + conf) @@ -564,12 +568,14 @@ def test_zip_importer_can_import_setuptools(tmp_path): # # coverage is disabled, because when coverage is active, it imports threading in default mode. @pytest.mark.xfail( - IS_PYPY and PY3 and sys.platform.startswith("darwin"), reason="https://foss.heptapod.net/pypy/pypy/-/issues/3269", + IS_PYPY and PY3 and sys.platform.startswith("darwin"), + reason="https://foss.heptapod.net/pypy/pypy/-/issues/3269", ) def test_no_preimport_threading(tmp_path, no_coverage): session = cli_run([ensure_text(str(tmp_path))]) out = subprocess.check_output( - [str(session.creator.exe), "-c", r"import sys; print('\n'.join(sorted(sys.modules)))"], universal_newlines=True, + [str(session.creator.exe), "-c", r"import sys; print('\n'.join(sorted(sys.modules)))"], + universal_newlines=True, ) imported = set(out.splitlines()) assert "threading" not in imported diff --git a/tests/unit/create/test_interpreters.py b/tests/unit/create/test_interpreters.py index 48fa486..59a0991 100644 --- a/tests/unit/create/test_interpreters.py +++ b/tests/unit/create/test_interpreters.py @@ -22,7 +22,8 @@ SYSTEM = PythonInfo.current_system() @pytest.mark.parametrize( - "of_id", ({sys.executable} if sys.executable != SYSTEM.executable else set()) | {SYSTEM.implementation}, + "of_id", + ({sys.executable} if sys.executable != SYSTEM.executable else set()) | {SYSTEM.implementation}, ) def test_failed_to_find_implementation(of_id, mocker): mocker.patch("virtualenv.run.plugin.creators.CreatorSelector._OPTIONS", return_value={}) diff --git a/tests/unit/create/via_global_ref/greet/setup.py b/tests/unit/create/via_global_ref/greet/setup.py index 3c88fc8..c1b48f6 100644 --- a/tests/unit/create/via_global_ref/greet/setup.py +++ b/tests/unit/create/via_global_ref/greet/setup.py @@ -7,7 +7,8 @@ setup( version="1.0", # package version ext_modules=[ Extension( - "greet", ["greet{}.c".format(sys.version_info[0])], # extension to package + "greet", + ["greet{}.c".format(sys.version_info[0])], # extension to package ), # C code to compile to run as extension ], ) |
