tox
tox copied to clipboard
tox fails without PATH environment variable
The tox
fails early without the PATH
environment variable and does not run any tests:
$ env - /usr/bin/tox -e py39
GLOB sdist-make: [REDACTED]
py39 inst-nodeps: [REDACTED]
________________________________________________________________________________________________________________________ summary _________________________________________________________________________________________________________________________
py39: commands succeeded
congratulations :)
Traceback (most recent call last):
File "/usr/bin/tox", line 8, in <module>
sys.exit(cmdline())
File "/usr/lib/python3.9/vendor-packages/tox/session/__init__.py", line 44, in cmdline
main(args)
File "/usr/lib/python3.9/vendor-packages/tox/session/__init__.py", line 69, in main
exit_code = session.runcommand()
File "/usr/lib/python3.9/vendor-packages/tox/session/__init__.py", line 197, in runcommand
return self.subcommand_test()
File "/usr/lib/python3.9/vendor-packages/tox/session/__init__.py", line 225, in subcommand_test
run_sequential(self.config, self.venv_dict)
File "/usr/lib/python3.9/vendor-packages/tox/session/commands/run/sequential.py", line 18, in run_sequential
installpkg(venv, venv.package)
File "/usr/lib/python3.9/vendor-packages/tox/session/commands/run/sequential.py", line 46, in installpkg
venv.installpkg(path, action)
File "/usr/lib/python3.9/vendor-packages/tox/venv.py", line 407, in installpkg
self.install_pkg(sdistpath, action, "inst")
File "/usr/lib/python3.9/vendor-packages/tox/venv.py", line 401, in install_pkg
self._install(target, extraopts=pip_flags, action=action)
File "/usr/lib/python3.9/vendor-packages/tox/venv.py", line 495, in _install
self.run_install_command(packages=packages, options=options, action=action)
File "/usr/lib/python3.9/vendor-packages/tox/venv.py", line 437, in run_install_command
self._pcall(
File "/usr/lib/python3.9/vendor-packages/tox/venv.py", line 598, in _pcall
path = self.envconfig.setenv.get("PATH") or os.environ["PATH"]
File "/usr/lib/python3.9/os.py", line 679, in __getitem__
raise KeyError(key) from None
KeyError: 'PATH'
$ echo $?
1
$
Even empty PATH
makes difference:
$ env - PATH= /usr/bin/tox -e py39
[...many lines skipped...]
================================================================================================= 16 failed, 560 passed, 21 skipped, 1 xfailed in 2.46s ==================================================================================================
ERROR: [REDACTED]
________________________________________________________________________________________________________________________ summary _________________________________________________________________________________________________________________________
ERROR: py39: commands failed
$
Why is no $PATH
available in your environment?
Why is no
$PATH
available in your environment?
Because I tried to run tox
with env -
to make sure the current environment does not affect tests. It is easy to add PATH
to the environment, but it is unclear why and how the PATH
should be set (i.e. what tox
needs to find in PATH
?). I failed to find any documentation saying that PATH
is need for tox
. Maybe I just didn't try hard enough...
Thank you.