Improve getopt and unix_getopt test coverage#153933
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
encukou
left a comment
There was a problem hiding this comment.
Looks good!
Please add the comments test_getopts as well.
It would be great to document the non-list behaviour, but that can go in a new PR.
cd76d9e to
8d42f3e
Compare
|
Thanks @flofriday for the PR, and @ZeroIntensity for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
GH-153972 is a backport of this pull request to the 3.15 branch. |
|
Sorry, @flofriday and @ZeroIntensity, I could not cleanly backport this to |
|
GH-153973 is a backport of this pull request to the 3.14 branch. |
|
GH-153975 is a backport of this pull request to the 3.13 branch. |
|
Something seems to be broken on 3.13, so let's skip the 3.13 backport. |
In both
getopt()andgnu_getopt()tests were missing for--to pass the remainder of theargsas unconsumed program arguments, as well as passing long-arguments as a plain string instead of a list of strings.For
gnu_getopt()this PR also adds a test for order-preservation with preceding non-option arguments before long-arguments.