Skip to content

tests require easy_install, removed from setuptools 52+ #1893

@hroncok

Description

@hroncok

I just wanted to build tox in Fedora after we have upgraded to setuptools 52 (no more easy_install) and two tests seem to be affected by the removal:

_________________________________ test_create __________________________________
[gw1] linux -- Python 3.9.1 /usr/bin/python3

mocksession = <tox._pytestplugin.create_mocksession.<locals>.MockSession object at 0x7f6f3911e670>
newconfig = <function create_new_config_file.<locals>.create_new_config_file_ at 0x7f6f391334c0>

    def test_create(mocksession, newconfig):
        config = newconfig(
            [],
            """\
            [testenv:py123]
            """,
        )
        envconfig = config.envconfigs["py123"]
        mocksession.new_config(config)
        venv = mocksession.getvenv("py123")
        assert venv.path == envconfig.envdir
        assert not venv.path.check()
        with mocksession.newaction(venv.name, "getenv") as action:
            tox_testenv_create(action=action, venv=venv)
        pcalls = mocksession._pcalls
        assert len(pcalls) >= 1
        args = pcalls[0].args
        assert "virtualenv" == str(args[2])
        if not tox.INFO.IS_WIN:
            # realpath is needed for stuff like the debian symlinks
            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())

action     = <tox.action.Action object at 0x7f6f39347100>
args       = ['/usr/bin/python3', '-m', 'virtualenv', '--no-download', '--python', '/usr/bin/python3', ...]
config     = <tox.config.Config object at 0x7f6f39347520>
envconfig  = <tox.config.TestenvConfig object at 0x7f6f3913ddc0>
mocksession = <tox._pytestplugin.create_mocksession.<locals>.MockSession object at 0x7f6f3911e670>
newconfig  = <function create_new_config_file.<locals>.create_new_config_file_ at 0x7f6f391334c0>
our_sys_path = local('/usr/bin/python3.9')
pcalls     = [<tox._pytestplugin.pcallMock object at 0x7f6f3a527760>]
venv       = <VirtualEnv at local('/tmp/pytest-of-mockbuild/pytest-0/popen-gw1/test_create0/.tox/py123')>

tests/unit/test_venv.py:81: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <VirtualEnv at local('/tmp/pytest-of-mockbuild/pytest-0/popen-gw1/test_create0/.tox/py123')>
name = 'easy_install', venv = True
cwd = local('/builddir/build/BUILD/tox-3.21.3')

    def getcommandpath(self, name, venv=True, cwd=None):
        """Return absolute path (str or localpath) for specified command name.
    
        - If it's a local path we will rewrite it as as a relative path.
        - If venv is True we will check if the command is coming from the venv
          or is allowed to come from external.
        """
        name = str(name)
        if os.path.isabs(name):
            return name
        if os.path.split(name)[0] == ".":
            path = cwd.join(name)
            if path.check():
                return str(path)
    
        if venv:
            path = self._venv_lookup_and_check_external_allowlist(name)
        else:
            path = self._normal_lookup(name)
    
        if path is None:
>           raise tox.exception.InvocationError(
                "could not find executable {}".format(pipes.quote(name)),
            )
E           tox.exception.InvocationError: InvocationError for command could not find executable easy_install

cwd        = local('/builddir/build/BUILD/tox-3.21.3')
name       = 'easy_install'
path       = None
self       = <VirtualEnv at local('/tmp/pytest-of-mockbuild/pytest-0/popen-gw1/test_create0/.tox/py123')>
venv       = True

../../BUILDROOT/python-tox-3.21.3-1.fc34.x86_64/usr/lib/python3.9/site-packages/tox/venv.py:193: InvocationError
_______________________ test_run_custom_install_command ________________________
[gw3] linux -- Python 3.9.1 /usr/bin/python3

newmocksession = <function newmocksession.<locals>.newmocksession_ at 0x7f26883edaf0>

    def test_run_custom_install_command(newmocksession):
        mocksession = newmocksession(
            [],
            """\
            [testenv]
            install_command=easy_install {opts} {packages}
            """,
        )
        venv = mocksession.getvenv("python")
        venv.just_created = True
        venv.envconfig.envdir.ensure(dir=1)
        with mocksession.newaction(venv.name, "hello") as action:
>           venv.run_install_command(packages=["whatever"], action=action)

action     = <tox.action.Action object at 0x7f2688379040>
mocksession = <tox._pytestplugin.create_mocksession.<locals>.MockSession object at 0x7f2683928910>
newmocksession = <function newmocksession.<locals>.newmocksession_ at 0x7f26883edaf0>
venv       = <VirtualEnv at local('/tmp/pytest-of-mockbuild/pytest-0/popen-gw3/test_run_custom_install_comman0/.tox/python')>

tests/unit/test_venv.py:914: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-tox-3.21.3-1.fc34.x86_64/usr/lib/python3.9/site-packages/tox/venv.py:426: in run_install_command
    self._pcall(
        action     = <tox.action.Action object at 0x7f2688379040>
        cmd        = ['easy_install', 'whatever']
        env        = {'CFLAGS': '-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security...-fstack-clash-protection -fcf-protection', 'CONFIG_SITE': 'NONE', 'HISTCONTROL': 'ignoredups', 'HISTSIZE': '1000', ...}
        expand     = <function VirtualEnv.run_install_command.<locals>.expand at 0x7f2688371280>
        old_stdout = <_io.TextIOWrapper name="<_io.FileIO name=8 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>
        options    = ()
        packages   = ['whatever']
        self       = <VirtualEnv at local('/tmp/pytest-of-mockbuild/pytest-0/popen-gw3/test_run_custom_install_comman0/.tox/python')>
../../BUILDROOT/python-tox-3.21.3-1.fc34.x86_64/usr/lib/python3.9/site-packages/tox/venv.py:591: in _pcall
    args[0] = self.getcommandpath(args[0], venv, cwd)
        action     = <tox.action.Action object at 0x7f2688379040>
        args       = ['easy_install', 'whatever']
        bin_dir    = '/tmp/pytest-of-mockbuild/pytest-0/popen-gw3/test_run_custom_install_comman0/.tox/python/bin'
        cwd        = local('/tmp/pytest-of-mockbuild/pytest-0/popen-gw3/test_run_custom_install_comman0')
        env        = {'CFLAGS': '-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security...-fstack-clash-protection -fcf-protection', 'CONFIG_SITE': 'NONE', 'HISTCONTROL': 'ignoredups', 'HISTSIZE': '1000', ...}
        ignore_ret = False
        is_test_command = False
        path       = '/builddir/build/BUILDROOT/python-tox-3.21.3-1.fc34.x86_64/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin'
        redirect   = True
        returnout  = False
        self       = <VirtualEnv at local('/tmp/pytest-of-mockbuild/pytest-0/popen-gw3/test_run_custom_install_comman0/.tox/python')>
        venv       = True
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <VirtualEnv at local('/tmp/pytest-of-mockbuild/pytest-0/popen-gw3/test_run_custom_install_comman0/.tox/python')>
name = 'easy_install', venv = True
cwd = local('/tmp/pytest-of-mockbuild/pytest-0/popen-gw3/test_run_custom_install_comman0')

    def getcommandpath(self, name, venv=True, cwd=None):
        """Return absolute path (str or localpath) for specified command name.
    
        - If it's a local path we will rewrite it as as a relative path.
        - If venv is True we will check if the command is coming from the venv
          or is allowed to come from external.
        """
        name = str(name)
        if os.path.isabs(name):
            return name
        if os.path.split(name)[0] == ".":
            path = cwd.join(name)
            if path.check():
                return str(path)
    
        if venv:
            path = self._venv_lookup_and_check_external_allowlist(name)
        else:
            path = self._normal_lookup(name)
    
        if path is None:
>           raise tox.exception.InvocationError(
                "could not find executable {}".format(pipes.quote(name)),
            )
E           tox.exception.InvocationError: InvocationError for command could not find executable easy_install

cwd        = local('/tmp/pytest-of-mockbuild/pytest-0/popen-gw3/test_run_custom_install_comman0')
name       = 'easy_install'
path       = None
self       = <VirtualEnv at local('/tmp/pytest-of-mockbuild/pytest-0/popen-gw3/test_run_custom_install_comman0/.tox/python')>
venv       = True

../../BUILDROOT/python-tox-3.21.3-1.fc34.x86_64/usr/lib/python3.9/site-packages/tox/venv.py:193: InvocationError

The error is tox.exception.InvocationError: InvocationError for command could not find executable easy_install

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug:normalaffects many people or has quite an impact

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions