Skip to content

Commit

Permalink
session: report more meaningful errors on why virtualenv creation failed
Browse files Browse the repository at this point in the history
virtualenv fails if the destination directory contains unicode
characters or spaces. A more descriptive error is printed if it's
likely that that was the case.
I didn't precheck the directory path for not supported characters
because if this problem is fixed by upstream we wouldn't want
execution to fail.
  • Loading branch information
Vaskó László committed Jul 15, 2017
1 parent acc2e51 commit da05e97
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tox/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,19 @@ def setupenv(self, venv):
envlog = self.resultlog.get_envlog(venv.name)
try:
status = venv.update(action=action)
except tox.exception.InvocationError:
status = sys.exc_info()[1]
except FileNotFoundError as e:
status = (
"Error creating virtualenv. "
"Note that spaces in path are not supported by virtualenv. "
"Error details: %r" % e
)
except tox.exception.InvocationError as e:
status = (
"Error creating virtualenv. "
"Note that some special characters (such as ':' and unicode symbols) "
"in path are not supported by virtualenv. "
"Error details: %r" % e
)
if status:
commandlog = envlog.get_commandlog("setup")
commandlog.add_command(["setup virtualenv"], str(status), 1)
Expand Down

0 comments on commit da05e97

Please sign in to comment.