Skip to content

Conversation

jezdez
Copy link
Member

@jezdez jezdez commented Jul 29, 2025

  • 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.

Refs #14886.

Description

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

jezdez added 3 commits July 29, 2025 11:54
- 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.
@jezdez jezdez requested a review from a team as a code owner July 29, 2025 10:18
@github-project-automation github-project-automation bot moved this to 🆕 New in 🔎 Review Jul 29, 2025
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Jul 29, 2025
@jezdez jezdez requested a review from travishathaway July 29, 2025 10:18
jezdez added 2 commits July 29, 2025 12:25
- 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.
Copy link

codspeed-hq bot commented Jul 29, 2025

CodSpeed Instrumentation Performance Report

Merging #15046 will not alter performance

Comparing lazy-choices-action-enhancements (58d8990) with main (8a8a18a)1

Summary

✅ 21 untouched benchmarks

Footnotes

  1. No successful run was found on main (c99d433) during the generation of this report, so 8a8a18a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

- 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
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Approved in 🔎 Review Jul 29, 2025
@jezdez jezdez merged commit e5eb9ad into main Jul 29, 2025
75 checks passed
@jezdez jezdez deleted the lazy-choices-action-enhancements branch July 29, 2025 12:55
@github-project-automation github-project-automation bot moved this from ✅ Approved to 🏁 Done in 🔎 Review Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed [bot] added once the contributor has signed the CLA
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants