cli
cli copied to clipboard
tests: fix test_lazy_choices_help for Python 3.13+ (Fixes #1641)
This pull request fixes a test called test_lazy_choices_help, which fails on Python 3.13 and 3.14.
The failure happens because argparse started calling the choices object when formatting help output. This causes the test’s getter.assert_not_called() line to fail, even though the behavior is still correct.
To fix this, I made the test version-aware:
- On Python versions before 3.13, the test still expects the getter to never be called.
- On Python 3.13 and later, it allows one harmless call and resets the mock so the rest of the test can continue.
This makes the test pass on all versions of Python and keeps the original behavior where possible.
Fixes #1641.