Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If install_command raises an OSError, get a traceback that doesn't tell you what failed #164

Closed
pytoxbot opened this issue Sep 17, 2016 · 3 comments

Comments

@pytoxbot
Copy link

$ cat install_command_error.ini
[testenv]
install_command = ./LICENSE {packages}
deps = pytest
commands = py.test
$ tox -c install_command_error.ini
GLOB sdist-make: /Users/marca/dev/hg-repos/tox/setup.py
python create: /Users/marca/dev/hg-repos/tox/.tox/python
python installdeps: pytest
Traceback (most recent call last):
  File "/Users/marca/python/virtualenvs/tox/bin/tox", line 9, in <module>
    load_entry_point('tox==1.7.1', 'console_scripts', 'tox')()
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 26, in main
    retcode = Session(config).runcommand()
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 303, in runcommand
    return self.subcommand_test()
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 440, in subcommand_test
    if self.setupenv(venv):
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 360, in setupenv
    status = venv.update(action=action)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 142, in update
    self.install_deps(action)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 255, in install_deps
    self._install(deps, action=action)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 318, in _install
    action=action, extraenv=extraenv)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 285, in run_install_command
    extraenv=env, action=action)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 367, in _pcall
    return action.popen(args, cwd=cwd, env=env, redirect=redirect)
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 97, in popen
    stdout=f, stderr=STDOUT)
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 155, in _popen
    stdout=stdout, stderr=stderr, env=env)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 709, in __init__
    errread, errwrite)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1326, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied

Note that the traceback doesn't tell you what the problem is -- that the install_command ("./LICENSE") was not executable.

@pytoxbot
Copy link
Author

Original comment by @hpk42

fix issue164: better traceback info in case of failing test commands.
Thanks Marc Abramowitz for the PR.

→ <<cset 3556f3c79bc7>>

@pytoxbot
Copy link
Author

Original comment by @msabramo

PR that attempt to fix this: https://bitbucket.org/hpk42/tox/pull-request/92/log-more-info-when-catch-oserror-while/diff

With this, I get:

 ❯ tox -c install_command_error.ini
GLOB sdist-make: /Users/marca/dev/hg-repos/tox/setup.py
python create: /Users/marca/dev/hg-repos/tox/.tox/python
python installdeps: pytest
ERROR: invocation failed, args: ['/Users/marca/dev/hg-repos/tox/LICENSE', 'pytest'], cwd: /Users/marca/dev/hg-repos/tox
Traceback (most recent call last):
  File "/Users/marca/python/virtualenvs/tox/bin/tox", line 9, in <module>
    load_entry_point('tox==1.7.1', 'console_scripts', 'tox')()
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 26, in main
    retcode = Session(config).runcommand()
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 308, in runcommand
    return self.subcommand_test()
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 445, in subcommand_test
    if self.setupenv(venv):
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 365, in setupenv
    status = venv.update(action=action)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 142, in update
    self.install_deps(action)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 255, in install_deps
    self._install(deps, action=action)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 318, in _install
    action=action, extraenv=extraenv)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 285, in run_install_command
    extraenv=env, action=action)
  File "/Users/marca/dev/hg-repos/tox/tox/_venv.py", line 367, in _pcall
    return action.popen(args, cwd=cwd, env=env, redirect=redirect)
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 98, in popen
    stdout=f, stderr=STDOUT)
  File "/Users/marca/dev/hg-repos/tox/tox/_cmdline.py", line 160, in _popen
    stdout=stdout, stderr=stderr, env=env)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 709, in __init__
    errread, errwrite)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1326, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied

@pytoxbot
Copy link
Author

Original comment by @msabramo

I have a PR coming...

@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant