Fix factor selection via TOX_FACTORS environment variable#3725
Fix factor selection via TOX_FACTORS environment variable#3725gaborbernat merged 2 commits intotox-dev:mainfrom
Conversation
gaborbernat
left a comment
There was a problem hiding this comment.
Please keep the PR draft until the CI passes.
7b8211c to
38fbf60
Compare
|
Rebased on main to pick up latest changes. Will mark ready for review once CI passes. |
|
Rebased on main, all tests pass. The only failures are |
|
Understood — converted back to draft. All test jobs pass (3.10-3.14 on Ubuntu/macOS/Windows), but the |
|
Note: the type/type-min CI failures are caused by |
The argparse action type for `-f`/`--factors` is `_AppendAction` with `nargs="+"`, which produces `list[list[str]]` at runtime. But `get_type()` only inferred `list[str]`, so `get_env_var()` produced a flat list of strings. When `_parse_factors()` iterated over this, it treated each character as a separate factor instead of each string. Fix `get_type()` to detect `nargs` on `_AppendAction` and return the correct nested type `list[list[str]]`. The existing `Convert` infrastructure already handles nested generics — semicolons separate OR groups, commas separate AND factors within a group. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
6bef4b4 to
b9bc025
Compare
|
Rebased on main (includes #3728). All CI checks passing — type/type-min now green. Marking ready for review. |
Summary
TOX_FACTORSenv var producing wrong results (each character treated as a separate factor instead of each factor string)get_type()inferredlist[str]for_AppendActionwithnargs="+", but the actual runtime type islist[list[str]]Convertinfrastructure already handles nested generics, so fixing the type inference is sufficientCloses #3557
Test plan
test_factor_select_via_env_varcovering single factor, AND (comma-separated), and OR (semicolon-separated)🤖 Generated with Claude Code