Tox: Tox fails to run if the total directory path exceeds 80 characters.

Created on 12 Oct 2017  路  6Comments  路  Source: tox-dev/tox

BUG:

OS: Ubuntu 14.04
Tox: 2.9.1
Pip: 9.0.1
Virtualenv: 15.1.0

Steps to reproduce:

mkdir ~/projects/pad_80_charactersssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
cd ~/projects/pad_80_charactersssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
git clone https://github.com/apache/beam.git
cd beam/sdks/python
tox -e lint

Output:

raceback (most recent call last):
  File "/usr/local/bin/tox", line 11, in <module>
    sys.exit(cmdline())
  File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 40, in main
    retcode = Session(config).runcommand()
  File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 392, in runcommand
    return self.subcommand_test()
  File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 558, in subcommand_test
    if self.setupenv(venv):
  File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 457, in setupenv
    status = venv.update(action=action)
  File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 176, in update
    self.hook.tox_testenv_install_deps(action=action, venv=self)
  File "/usr/local/lib/python2.7/dist-packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/usr/local/lib/python2.7/dist-packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 457, in tox_testenv_install_deps
    venv._install(deps, action=action)
  File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 335, in _install
    action=action)
  File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 308, in run_install_command
    redirect=self.session.report.verbosity < 2)
  File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 414, in _pcall
    redirect=redirect, ignore_ret=ignore_ret)
  File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 140, in popen
    stdout=stdout, stderr=subprocess.STDOUT)
  File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 228, in _popen
    stdout=stdout, stderr=stderr, env=env)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied

Reducting the total path to directory containing tox.ini to 79 characters or less fixes the issue.
Possibly related: https://github.com/tox-dev/tox/issues/66

upstream

Most helpful comment

For anyone using Jenkins pipeline, it will surely be over 80 chars for the base-path and there's not much we can do about that.

All 6 comments

Yes I encoutered this limitation as well, but I think there's nothing tox can do. It's a system issue (with shebang length limit) or a setuptools and distlib issue (with the way it install packages / entry points).

The only workaround is to avoid too deep directory tree :/

Edit: there are other workarounds: https://github.com/pypa/pip/issues/1773#issuecomment-263181814, also calling pip with python -m pip but this might not apply in tox case.

In this case I think it would be helpful if we identified the problem at the beginning of test suite execution, printed a meaningful error message explaining the limitations, and stopped the execution.

Some kind of sanity check for all theses problems at the beginning of a tox run would definitely be helpful. There are quite a few of these things, which are not really tox bugs as such, but due to upstream problems or OS specific limitations.

The problem with "up-front" checks is that they are conditional
and expressing the conditions can be tricky and possibly needs to
be maintained. In principle there are things that tox
might do like these:

  • try to minimize the length of what it adds to the path

  • try to (optionally) use a global tmp directory with
    a hashed/unique component added.

my 2cent
h

For anyone using Jenkins pipeline, it will surely be over 80 chars for the base-path and there's not much we can do about that.

This should now be fixed via https://github.com/tox-dev/tox/pull/935

Was this page helpful?
0 / 5 - 0 ratings