tox-dev / tox-uv

Use https://github.com/astral-sh/uv with tox
MIT License
135 stars 19 forks source link

macos: test_uv_venv_skip_missing_interpreters_fail test fails #130

Open ssbarnea opened 4 days ago

ssbarnea commented 4 days ago

Issue

Environment

Provide at least:

Output of pip list of the host Python, where tox is installed ```console macos ```

Output of running tox

Output of tox -rvv ```console ========================================================================== FAILURES ========================================================================== ________________________________________________________ test_uv_venv_skip_missing_interpreters_fail _________________________________________________________ tox_project = ._init at 0x10350a200> def test_uv_venv_skip_missing_interpreters_fail(tox_project: ToxProjectCreator) -> None: project = tox_project({ "tox.ini": "[tox]\nskip_missing_interpreters=false\n[testenv]\npackage=skip\nbase_python=1.0" }) result = project.run("-vv") > result.assert_failed(code=1) tests/test_tox_uv_venv.py:123: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = code: -1 cmd: /Users/ssbarnea/code/os/tox-uv/.tox/py/bin/python -m tox -vv cwd: /private/var/folders/32/1xrphgzd4xv777... Python request `1` from explicit request × Invalid version request: Python <3 is not supported but 1 was requested. code = 1 def assert_failed(self, code: int | None = None) -> None: status_match = self.code != 0 if code is None else self.code == code > assert status_match, f"should be {code}, got {self}" # noqa: S101 E AssertionError: should be 1, got code: -1 E cmd: /Users/ssbarnea/code/os/tox-uv/.tox/py/bin/python -m tox -vv E cwd: /private/var/folders/32/1xrphgzd4xv777syxjtkpdw80000gn/T/pytest-of-ssbarnea/pytest-90/test_uv_venv_skip_missing_inte0/p E standard output E ROOT: 9676 D setup logging to DEBUG on pid 36143 [tox/report.py:222] E py: 9697 W venv> /Users/ssbarnea/code/os/tox-uv/.tox/py/bin/uv venv -p 1 --allow-existing -v /private/var/folders/32/1xrphgzd4xv777syxjtkpdw80000gn/T/pytest-of-ssbarnea/pytest-90/test_uv_venv_skip_missing_inte0/p/.tox/py [tox/tox_env/api.py:427] E py: 9715 W skipped because could not find python interpreter with spec(s): 1 [tox/session/cmd/run/single.py:50] E py: SKIP (0.02 seconds) E evaluation failed :( (0.04 seconds) E E standard error E DEBUG uv 0.5.2 (195f4b634 2024-11-14) E DEBUG Using Python request `1` from explicit request E × Invalid version request: Python <3 is not supported but 1 was requested. E E assert False .tox/py/lib/python3.12/site-packages/tox/pytest.py:361: AssertionError ```

Minimal example

ssbarnea commented 4 days ago

Debugging update

I was able to spot that self.request.allow from https://github.com/tox-dev/tox/blob/5d880fc93c22d37585f838f8f5359be2714223bb/src/tox/execute/local_sub_process/__init__.py#L179 contains only:

(Pdb) self.request.allow
['/Users/ssbarnea/.config/mise/installs/python/3.12.7/bin/uv']

And that is why it fails.

When run without the tox-uv plugin this attribute contains ['.../.tox/py/bin/*'] and I guess that is why it works.

This is happening with the minimal tox.ini file from tha test, one that does not even have any allowlist_externals or even commands inside.