Skip to content
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

Consider complete envs, not factors #3220

Closed
wants to merge 1 commit into from

Conversation

stephenfin
Copy link
Contributor

To determine whether we have been given a valid env, we compare the factors of the env to our known set of factors. If a testenv contains a series of valid factors, we assume the testenv is valid. This is an incorrect assumption: a testenv is only valid if it defined in the configuration file or is one of the "special" auto-generated testenvs like e.g. 'py310'. Correct this mistake.

This is a draft PR while I wait for feedback on my general idea here. I'd like to confirm that my understanding of expected behavior is correct.

Signed-off-by: Stephen Finucane [email protected]
Closes: #3219

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation

To determine whether we have been given a valid *env*, we compare the
*factors* of the *env* to our known set of *factors*. If a testenv
contains a series of valid factors, we assume the testenv is valid. This
is an incorrect assumption: a testenv is only valid if it defined in the
configuration file *or* is one of the "special" auto-generated testenvs
like e.g. 'py310'. Correct this mistake.

While we're here, we make use of verbose mode to explain our regex for
matching "magic" factors better.

Signed-off-by: Stephen Finucane <[email protected]>
Closes: tox-dev#3219
@stephenfin
Copy link
Contributor Author

stephenfin commented Feb 15, 2024

This is currently failing a few tests because it does not allow for autogenerated testenvs based on factors defined in e.g. [testenv] commands. For example:

[testenv]
commands =
    foo: echo "got foo"
    bar: echo "got bar"

That this worked suprised me: I'd normally have defined this in my tox.ini like so:

[testenv:py{310,311,312}{,-cov}]

but that is definitely duplication. I can work to fix this but again, I want to confirm that the bug I'm seeing is indeed a bug (it really feels like one)

@stephenfin
Copy link
Contributor Author

Converting to non-draft, even though it's clearly not complete, so that folks see it.

@stephenfin stephenfin marked this pull request as ready for review February 15, 2024 16:49
@gaborbernat gaborbernat marked this pull request as draft February 15, 2024 16:49
@gaborbernat
Copy link
Member

Converting to non-draft, even though it's clearly not complete, so that folks see it.

We see, without it too, was waiting for you to pass the CI.

This is an incorrect assumption: a testenv is only valid if it defined in the configuration file or is one of the "special" auto-generated testenvs like e.g. 'py310'. Correct this mistake.

I'd say, in general, yes. But note, I want to allow py313-magic if py312-magic is defined. This will make testing a new Python interpreter version not require defining that in the configuration.

@gaborbernat
Copy link
Member

Closing as seems it stalled, we can reopen if you get time again for it.

@gaborbernat gaborbernat closed this Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Partial match on testenv results in use of base testenv
2 participants