python-tuf
python-tuf copied to clipboard
tox warns on windows that python3 is not installed in testenv
The following warning can be found in current GitHub Windows runner build logs.
WARNING: test command found but not installed in testenv
cmd: C:\hostedtoolcache\windows\Python\3.8.10\x64\python3.EXE
env: D:\a\python-tuf\python-tuf\.tox\py
Maybe you forgot to specify a dependency? See also the allowlist_externals envconfig setting.
DEPRECATION WARNING: this will be an error in tox 4 and above!
This is because we tell tox to run python3 in the tox.ini commands section, see e.g.:
https://github.com/theupdateframework/python-tuf/blob/b2704a56a8c5023ffd7d377d8a8e72fb26a46a8a/tox.ini#L18
But Windows does not seem to install a python3 command in the corresponding virtual environment, so it uses the system python3.exe, which tox warns about if we don't whitelist it.
Possible fixes:
- Configure GitHub windows runner to install python3 in virtual environment
NOTE: I didn't check if we also get this warning for
python(as we did before #1493), if we don't we could change backpython3topythonbecause that latter should run the python version for which the virtual environment was created anyway, which are only version 3 pythons. - Whitelist python3 in tox.ini (I wouldn't do that, because we do want to use the python of the dedicated virtual environment and not any system python)
I can check the first possible fix. But I think we discussed it on
- #1617
I guess it could be a good idea to check if virtualenv (?) really doesn't create that specific link in the windows environment and then either
- make an issue upstream to add that link in Windows or
- stop using "python3" (if the "python" link is created on Windows and if it looks like the rest of the world is using plain "python" instead of "python3")
Changing python3 to python might work for windows users but, python3 command works on mac and python command works on windows. what can we do so that both the platforms can run the same tox file without any error ? 🤔💭 Please correct me if I am wrong.
Today while running the tox file I faced the same issue. Tox was giving warning but later it ran all the test cases successfully by giving warnings on the go. I am a windows user.
(from possible fixes):
- Whitelist python3 in tox.ini (I wouldn't do that, because we do want to use the python of the dedicated virtual environment and not any system python)
I believe we always use the "system" python in CI: It is the GitHub actions machinery that selects the python version. So I think whitelisting in tox would be ok -- we use "host" python in any case. I just haven't figured out how to actually do that yet
I just haven't figured out how to actually do that yet
~~https://tox.wiki/en/2.8.0/config.html#confval-whitelist_externals=MULTI-LINE-LIST ?~~
edit: Never mind my comment above. It points to outdated docs, plus you already seem to have figured out the solution in #2252. Sorry for the noise!