-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add LazyChoicesAction enhancements with caching #15046
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
Merged
Merged
+385
−5
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add choices property for dynamic evaluation - Add choices setter to ignore argparse initialization - Implement caching to avoid repeated calls to choices_func - Add comprehensive test suite for LazyChoicesAction This is a clean port of commits 75a6e36 and 541b679 from env-exporter-hook branch, focusing only on the LazyChoicesAction improvements without dependencies on other features.
- Fix test_conda_food_choices to expect duplicate choices in help text (argparse behavior) - Fix test_argumentparser_help_integration to use correct fixture and expectations - All 20 tests now pass successfully
- Update food_choices fixture to provide realistic food options. - Change argument parser options from `--format` to `--food` and update related help text. - Adjust tests to reflect new food choice options, ensuring all tests pass successfully.
- Refactor test_valid_choice_handling and test_invalid_choice_handling to use parameterization for valid and invalid choices. - Update test_argumentparser_help_integration to verify help text for various choice sets. - Introduce test_argumentparser_error_handling and test_argumentparser_valid_parsing with parameterized inputs. - Improve test_non_list_iterable_choices to handle different iterable types. - Consolidate multiple option string tests into a single parameterized test for better coverage. - Add realistic integration tests for conda scenarios with parameterized choices and help text validation.
CodSpeed Instrumentation Performance ReportMerging #15046 will not alter performanceComparing Summary
Footnotes |
- Update error message format to use 'argument option1/option2:' instead of 'argument "option1":' - This matches standard argparse behavior for arguments with multiple option strings - Update test expectations in test_all_commands.py to match the correct format - Fixes failing test_commands_with_plugin_backed_options
travishathaway
approved these changes
Jul 29, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a clean port of commits 75a6e36 and 541b679 from env-exporter-hook branch,
focusing only on the LazyChoicesAction improvements without dependencies on other features.
Refs #14886.
Description
Checklist - did you ...
news
directory (using the template) for the next release's release notes?