Skip to content

馃悰 fix(config): stop splitting factor names that look like ranges - #4053

Merged
gaborbernat merged 5 commits into
tox-dev:mainfrom
MohammedAlkindi:fix/factor-range-anchor
Aug 31, 2026
Merged

馃悰 fix(config): stop splitting factor names that look like ranges#4053
gaborbernat merged 5 commits into
tox-dev:mainfrom
MohammedAlkindi:fix/factor-range-anchor

Conversation

@MohammedAlkindi

@MohammedAlkindi MohammedAlkindi commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

tox pulled an environment name ending in a digit, a hyphen and another digit apart, as though the tail were a generative range. py313-django4-2 never got created: tox made py313-django4, 3 and 2 instead, and said nothing. py310-1,py310-2 turned into more than three hundred environments, counting down from 310.

A range now has to open a factor, so digits carrying on a name stay part of it. The documented range forms keep working, including one written after a comma and a space, and a version-shaped name such as 3.10-2 survives too.

The same expansion sits behind -e on the command line, behind generative section names and behind factor conditions, so those pick up the fix as well.

The left-open form {-13} keeps its narrower rule. Widening it to match would swallow the trailing -2 in py3{10-11}-2,x.

Two of the three alternatives in expand_ranges were unanchored, so any
digit-hyphen-digit run followed by a comma or a closing brace was expanded
as a generative range even in the middle of an ordinary factor name.

env_list = py313-django4-2,py313-django5-1 produced four environments
instead of two: the requested py313-django4-2 was never created, and two
junk environments named 3 and 2 appeared in its place.

The left-open alternative keeps its existing (?<= [{,] ) anchor. Giving it
the same lookbehind would break py3{10-11}-2,x by reading the trailing -2
as a left-open range and dropping it.
pre-commit-ci Bot and others added 2 commits August 31, 2026 10:53
The two range alternatives each repeated the lookbehind, and neither
said why digits carrying on a name are not a range. A non-capturing
group over both keeps the group numbering `_expand` unpacks while
stating the rule once.

Dropping the dot from the guard left every test passing while `3.10-2`
started expanding again, so the two added cases pin that half of it.
@gaborbernat gaborbernat changed the title 馃悰 fix(config): only expand a digit range at a factor boundary 馃悰 fix(config): stop splitting factor names that look like ranges Aug 31, 2026
The reference lists which ranges expand and which do not, but never
where one is looked for, so a name like py313-django4-2 coming apart
read as arbitrary. The rule now sits beside the other non-expanding
cases, and notes that it holds for -e as well as env_list.
@gaborbernat
gaborbernat merged commit f31ebed into tox-dev:main Aug 31, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants