Skip to content
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

Tests failing on Python 3.13 #156

Closed
JelleZijlstra opened this issue Dec 5, 2024 · 2 comments · Fixed by #157
Closed

Tests failing on Python 3.13 #156

JelleZijlstra opened this issue Dec 5, 2024 · 2 comments · Fixed by #157

Comments

@JelleZijlstra
Copy link

Over on typing-extensions we run the typed-argument-parser tests daily on various Python versions. They started failing on Python 3.13 (python/typing_extensions#513):


https://github.com/python/typing_extensions/actions/runs/12172317648/job/33950775320

typed-argument-parser tests are failing on 3.13:

=========================== short test summary info ============================
FAILED tests/test_to_tap_class.py::test_subclasser_subparser[function-args_string_and_arg_to_expected_value7] - assert "error: argument {a,b}: invalid choice: 'X' (choose from 'a', 'b')" in "usage: pytest [--foo] --arg_int ARG_INT [--arg_bool]\n              [--arg_list [ARG_LIST ...]] [-h]\n              {a,b} ...\npytest: error: argument {a,b}: invalid choice: 'X' (choose from a, b)\n"
 +  where "error: argument {a,b}: invalid choice: 'X' (choose from 'a', 'b')" = str(SystemExit("error: argument {a,b}: invalid choice: 'X' (choose from 'a', 'b')"))
FAILED tests/test_to_tap_class.py::test_subclasser_subparser[Class-args_string_and_arg_to_expected_value7] - assert "error: argument {a,b}: invalid choice: 'X' (choose from 'a', 'b')" in "usage: pytest [--foo] --arg_int ARG_INT [--arg_bool]\n              [--arg_list [ARG_LIST ...]] [-h]\n              {a,b} ...\npytest: error: argument {a,b}: invalid choice: 'X' (choose from a, b)\n"
 +  where "error: argument {a,b}: invalid choice: 'X' (choose from 'a', 'b')" = str(SystemExit("error: argument {a,b}: invalid choice: 'X' (choose from 'a', 'b')"))
FAILED tests/test_to_tap_class.py::test_subclasser_subparser[_Args-args_string_and_arg_to_expected_value7] - assert "error: argument {a,b}: invalid choice: 'X' (choose from 'a', 'b')" in "usage: pytest [--foo] --arg_int ARG_INT [--arg_bool]\n              [--arg_list [ARG_LIST ...]] [-h]\n              {a,b} ...\npytest: error: argument {a,b}: invalid choice: 'X' (choose from a, b)\n"
 +  where "error: argument {a,b}: invalid choice: 'X' (choose from 'a', 'b')" = str(SystemExit("error: argument {a,b}: invalid choice: 'X' (choose from 'a', 'b')"))
FAILED tests/test_to_tap_class.py::test_subclasser_subparser[class_or_function_3-args_string_and_arg_to_expected_value7] - assert "error: argument {a,b}: invalid choice: 'X' (choose from 'a', 'b')" in "usage: pytest [--foo] --arg_int ARG_INT [--arg_bool]\n              [--arg_list [ARG_LIST ...]] [-h]\n              {a,b} ...\npytest: error: argument {a,b}: invalid choice: 'X' (choose from a, b)\n"
 +  where "error: argument {a,b}: invalid choice: 'X' (choose from 'a', 'b')" = str(SystemExit("error: argument {a,b}: invalid choice: 'X' (choose from 'a', 'b')"))
======================== 4 failed, 301 passed in 1.58s =========================

https://github.com/python/typing_extensions/actions/runs/12172317648/job/33950775320

I suspect it's related to some of the argparse changes in Python 3.13.1. (Run git diff v3.13.0 v3.13.1 -- Lib/argparse.py in the CPython repo; a fair amount of code changed.) I haven't looked into this further.

@brianschubert
Copy link
Contributor

This is likely a consequence of python/cpython#117766, which changed how the choices are displayed in the error message (switched from repr to str). That PR was backported to 3.13.1 and 3.12.8

martinjm97 added a commit that referenced this issue Dec 8, 2024
Fix tests for Python 3.12.8 and 3.13.1.
@martinjm97
Copy link
Collaborator

Thank you @JelleZijlstra for raising this issue! We're happy to hear that Tap is being tested more broadly! We've accepted @brianschubert's fix, which seems to solve the string match problem for the error message.

Thanks again,
JK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants