Skip to content

✨ feat(cli): accept plugin CLI options during provisioning#3791

Merged
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:fix/2935-plugin-cli-provision
Feb 20, 2026
Merged

✨ feat(cli): accept plugin CLI options during provisioning#3791
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:fix/2935-plugin-cli-provision

Conversation

@gaborbernat
Copy link
Copy Markdown
Member

Plugins that add CLI options via tox_add_option couldn't be used with requires-based provisioning. Running tox --demo-plugin where --demo-plugin is defined by a plugin in requires would fail with "unrecognized arguments" because CLI argument validation happened before provisioning had a chance to install the plugin and re-execute tox.

🔧 The fix defers unknown argument validation until after the provisioning check. During initial CLI parsing, parse_known_args is used instead of parse_args, allowing unrecognized flags through. If provisioning is needed, tox re-executes in the provisioned environment where the plugin is installed and the flag is recognized. If provisioning is not needed, any remaining unknown arguments still raise the familiar error message — so typos and invalid flags are still caught.

The demo plugin used in integration tests now also registers a --demo-plugin CLI flag via tox_add_option to exercise this path.

Fixes #2935

@gaborbernat gaborbernat added feature:change something exists already but should behave differently area:plugins-hooks labels Feb 20, 2026
@gaborbernat gaborbernat force-pushed the fix/2935-plugin-cli-provision branch from ab12c37 to 755efa8 Compare February 20, 2026 04:34
@gaborbernat gaborbernat enabled auto-merge (squash) February 20, 2026 04:48
@gaborbernat gaborbernat merged commit 0c08af3 into tox-dev:main Feb 20, 2026
28 checks passed
@gaborbernat gaborbernat deleted the fix/2935-plugin-cli-provision branch February 20, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:plugins-hooks bot:chronographer:provided feature:change something exists already but should behave differently

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot invoke tox with CLI options provided by plugins that will be provisioned

1 participant