From 7355b6559801cff3a2249eb3865eaf6f6887c26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 2 Feb 2021 20:13:01 +0100 Subject: [PATCH] Adapt tests not to assume easy_install exists, it was removed from setuptools (#1894) Fixes https://github.com/tox-dev/tox/issues/1893 --- docs/changelog/1893.bugfix.rst | 1 + tests/unit/test_venv.py | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 docs/changelog/1893.bugfix.rst diff --git a/docs/changelog/1893.bugfix.rst b/docs/changelog/1893.bugfix.rst new file mode 100644 index 000000000..c25437df1 --- /dev/null +++ b/docs/changelog/1893.bugfix.rst @@ -0,0 +1 @@ +Adapt tests not to assume the ``easy_install`` command exists, as it was removed from ``setuptools`` 52.0.0+ - by :user:`hroncok` diff --git a/tests/unit/test_venv.py b/tests/unit/test_venv.py index dbfd380f2..22e76cf54 100644 --- a/tests/unit/test_venv.py +++ b/tests/unit/test_venv.py @@ -78,7 +78,7 @@ def test_create(mocksession, newconfig): our_sys_path = py.path.local(sys.executable).realpath() assert our_sys_path == py.path.local(args[0]).realpath() # assert Envconfig.toxworkdir in args - assert venv.getcommandpath("easy_install", cwd=py.path.local()) + assert venv.getcommandpath("pip", cwd=py.path.local()) interp = venv._getliveconfig().base_resolved_python_path assert interp == venv.envconfig.python_info.executable assert venv.path_config.check(exists=False) @@ -112,10 +112,10 @@ def test_commandpath_venv_precedence(tmpdir, monkeypatch, mocksession, newconfig mocksession.new_config(config) venv = mocksession.getvenv("py123") envconfig = venv.envconfig - tmpdir.ensure("easy_install") + tmpdir.ensure("pip") monkeypatch.setenv("PATH", str(tmpdir), prepend=os.pathsep) - envconfig.envbindir.ensure("easy_install") - p = venv.getcommandpath("easy_install") + envconfig.envbindir.ensure("pip") + p = venv.getcommandpath("pip") assert py.path.local(p).relto(envconfig.envbindir), p @@ -904,17 +904,18 @@ def test_run_custom_install_command(newmocksession): [], """\ [testenv] - install_command=easy_install {opts} {packages} + install_command=cool-installer {opts} {packages} """, ) venv = mocksession.getvenv("python") venv.just_created = True venv.envconfig.envdir.ensure(dir=1) + venv.envconfig.envbindir.ensure("cool-installer") with mocksession.newaction(venv.name, "hello") as action: venv.run_install_command(packages=["whatever"], action=action) pcalls = mocksession._pcalls assert len(pcalls) == 1 - assert "easy_install" in pcalls[0].args[0] + assert "cool-installer" in pcalls[0].args[0] assert pcalls[0].args[1:] == ["whatever"]