-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
Fix various issues with missing interpreters #2828
Commits on Jan 6, 2023
-
Correctly skip/fail env for cached base_python values
We were correctly raising the Skip or NoInterpreter exceptions upon first access of the 'base_python' property of the 'Python' class, however, subsequent calls would simply return None. This meant we did not trigger our exception flow as expected and resulted in a traceback like so: ❯ tox --skip-missing-interpreter=true -e py33 py33: internal error Traceback (most recent call last): File "/tox/src/tox/session/cmd/run/single.py", line 45, in _evaluate tox_env.setup() File "/tox/src/tox/tox_env/api.py", line 248, in setup self._setup_env() File "/tox/src/tox/tox_env/python/runner.py", line 106, in _setup_env super()._setup_env() File "/tox/src/tox/tox_env/python/api.py", line 186, in _setup_env self.ensure_python_env() File "/tox/src/tox/tox_env/python/api.py", line 190, in ensure_python_env conf = self.python_cache() ^^^^^^^^^^^^^^^^^^^ File "/tox/src/tox/tox_env/python/virtual_env/api.py", line 77, in python_cache base = super().python_cache() ^^^^^^^^^^^^^^^^^^^^^^ File "/tox/src/tox/tox_env/python/api.py", line 228, in python_cache "version_info": list(self.base_python.version_info), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'version_info' py33: FAIL code 2 (0.00 seconds) evaluation failed :( (0.06 seconds) (from an environment without Python 3.3) Correct this so that we also raise these exceptions on subsequent accesses. ❯ tox --skip-missing-interpreter=true -e py33 py33: skipped because could not find python interpreter with spec(s): py33 py33: SKIP (0.00 seconds) evaluation failed :( (0.06 seconds) Note that this fix emphasises a change in behavior in tox 4. With the above configuration, tox 3 would have skipped the environment a reported success. By comparison, tox 4 reports a failure. This behavior change was introduced in tox-dev#2206. A future change will note this in the documentation. Also note that this is still not complete. Running the above command with '--skip-missing-interpreters=false' instead will currently result in an unhandled exception. This is an existing issue that will need to be addressed separately. Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: tox-dev#2826
Configuration menu - View commit details
-
Copy full SHA for 07a77e4 - Browse repository at this point
Copy the full SHA 07a77e4View commit details -
By using the property rather than the attribute, we can rely on an exception being raised and no longer need to manually assert this ourselves. Signed-off-by: Stephen Finucane <stephen@that.guru>
Configuration menu - View commit details
-
Copy full SHA for e01b8e3 - Browse repository at this point
Copy the full SHA e01b8e3View commit details -
Note change in behaviour when all envs are skipped
This behavior change was introduced in tox-dev#2206 and fixed tox-dev#2195. Call it out in the upgrade docs. Signed-off-by: Stephen Finucane <stephen@that.guru>
Configuration menu - View commit details
-
Copy full SHA for 8457a43 - Browse repository at this point
Copy the full SHA 8457a43View commit details -
Ignore missing interpreters when classifying env type
We now separate environments into either run or packaging environments [1]. As noted in 'tox.session.env_select.EnvSelector._defined_envs' [2], the name of the environment is not enough to determine what type of environment it is and we must actually build the environment and inspect it. This allows us to prevent users *running* these packaging environments (e.g. 'tox -e .pkg'). Part of this process of building an environment is validating the base python. If this validation fails (i.e. the Python version does not exist), we will raise 'tox.tox_env.python.api.NoInterpreter'. We were not handling this exception, and thus the process of determining the types of each environment would cause a failure if any environment requested a Python version we did not support, even if we weren't actually trying to run this environment. The fix for this is simple: handle the exception and simply ignore these unsupported environments. While we're here, fix some issues with an existing test that were noticed while adding new tests. [1] https://tox.wiki/en/latest/upgrading.html#packaging-configuration-and-inheritance [2] https://github.com/tox-dev/tox/blob/af35384bb2ee/src/tox/session/env_select.py#L173 Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: tox-dev#2811
Configuration menu - View commit details
-
Copy full SHA for ac5dcb3 - Browse repository at this point
Copy the full SHA ac5dcb3View commit details -
Return non-zero error code on skipped env
In tox-dev#2206, we said that tox should fail if all envs are skipped. This is broken when only a single env runs. We print an error message but return 0. Correct this behavior. Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: tox-dev#2827
Configuration menu - View commit details
-
Copy full SHA for 5505c82 - Browse repository at this point
Copy the full SHA 5505c82View commit details -
Add missing attributions to changelog entries
Signed-off-by: Stephen Finucane <stephen@that.guru>
Configuration menu - View commit details
-
Copy full SHA for 3039214 - Browse repository at this point
Copy the full SHA 3039214View commit details