Skip to content

No "did you mean" suggestion when only some factors of an -e name are wrong #4458

Done

Description

@arindam77

Issue

When an environment passed with -e is not found, tox suggests a close name, but only if every factor is misspelled. If any factor is valid, no suggestion is shown.

tox.ini:

[tox]
env_list = release, alpha-py312
[testenv]
package = skip
$ tox r -e alpha-p312,alph-p312
ROOT: HandledError| provided environments not found in configuration file:
alpha-p312
alph-p312 - did you mean alpha-py312?

alph-p312 (both factors wrong) gets a suggestion, but alpha-p312 (one factor wrong) gets nothing. The same happens for environments that are only defined as sections, for example [testenv:beta-lint] with -e beta-lnt.

Cause

In EnvSelector._invalid_env_suggestion (src/tox/session/env_select.py), valid factors keep their initial None, and a factor whose closest match is itself is also set to None. Any None drops the whole suggestion.

Environment

  • tox main (794908a), Python 3.12, Windows 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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