Skip to content

Commit 3cba82d

Browse files
decembercomposer697-hue十二月作曲家
authored andcommitted
fix: adjust lazy_choices test for Python 3.14+ argparse changes
Python 3.14 calls the getter during argparse initialisation, breaking the lazy evaluation test. Added version check to account for this.
1 parent 5b604c3 commit 3cba82d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests/test_cli_utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,17 @@ def test_lazy_choices():
5050

5151

5252
def test_lazy_choices_help():
53+
import sys
5354
mock = Mock()
5455
getter = mock.getter
5556
getter.return_value = ['a', 'b', 'c']
5657

58+
# Python 3.14+ calls getter during argparse initialisation
59+
if sys.version_info >= (3, 14):
60+
from unittest.mock import ANY
61+
getter.assert_called()
62+
getter.reset_mock()
63+
5764
help_formatter = mock.help_formatter
5865
help_formatter.return_value = '<my help>'
5966

0 commit comments

Comments
 (0)