Open
Description
Problem
Some testenv names may unintentionally conflict with other directories created in the toxworkdir
. For example, I recently wanted to add a specific build for testing the distribution, naturally naming it dist
. My tox.ini looked something like:
[tox]
envlist = py27,py34,py35,py36,dist
[testenv]
commands = coverage run setup.py test
usedevelop = True
[testenv:dist]
commands = python setup.py test
usedevelop = False
Running tox -e dist
generating the following error, which was a little confusing:
Traceback (most recent call last):
File "./.venv/bin/tox", line 11, in <module>
sys.exit(cmdline())
File "./.venv/lib/python3.6/site-packages/tox/session.py", line 40, in main
retcode = Session(config).runcommand()
File "./.venv/lib/python3.6/site-packages/tox/session.py", line 392, in runcommand
return self.subcommand_test()
File "./.venv/lib/python3.6/site-packages/tox/session.py", line 567, in subcommand_test
self.installpkg(venv, path)
File "./.venv/lib/python3.6/site-packages/tox/session.py", line 503, in installpkg
self.resultlog.set_header(installpkg=py.path.local(path))
File "./.venv/lib/python3.6/site-packages/tox/result.py", line 25, in set_header
md5=installpkg.computehash("md5"),
File "./.venv/lib/python3.6/site-packages/py/_path/local.py", line 232, in computehash
f = self.open('rb')
File "./.venv/lib/python3.6/site-packages/py/_path/local.py", line 361, in open
return py.error.checked_call(open, self.strpath, mode)
File "./.venv/lib/python3.6/site-packages/py/_error.py", line 86, in checked_call
raise cls("%s%r" % (func.__name__, args))
py.error.ENOENT: [No such file or directory]: open('./.tox/dist/package-0.0.1.zip', 'rb')
The issue was that the sdist was being built in the dist
directory, which conflicted with the dist
testenv.
Proposed changes
- Change the default
envdir
to something like{toxworkdir}/venvs/{envname}
. idk if this would be considered backwards incompatible. - Raise a more infromative exception that complains about known bad testenv names, suggesting that they either change the name or set
envdir
to{toxworkdir}/venvs/{envname}
.
This isn't exactly a high priority issue or anything. The immediate fix is to just change the envdir
, as demonstrated above.