Skip to content

Requesting missing interpreter with 'usedevelop = true' results in AttributeError #2826

@stephenfin

Description

@stephenfin

Issue

Given the following minimal tox.ini:

[testenv]
envlist = python3

[testenv]
usedevelop = true

Running with a random pyXY factor on a host that doesn't have pythonX.Y results in an AttributeError:

py32: 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'
  py32: FAIL code 2 (0.00 seconds)
  evaluation failed :( (0.06 seconds

This was alluded to in #2811 but that issue tracks a separate bug.

Environment

Provide at least:

  • OS: Fedora 36
  • pip list of the host Python where tox is installed:
pip list
Package       Version
------------- -------
cachetools    5.2.0
chardet       5.1.0
colorama      0.4.6
distlib       0.3.6
filelock      3.9.0
packaging     22.0
pip           22.3.1
platformdirs  2.6.2
pluggy        1.0.0
pyproject_api 1.4.0
setuptools    65.6.3
tox           4.2.4
virtualenv    20.17.1
wheel         0.38.4

Output of running tox

Provide the output of tox -rvv:

(not relevant)

Minimal example

If possible, provide a minimal reproducer for the issue:

(see above)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions