Skip to content

Improve getopt and unix_getopt test coverage#153933

Merged
ZeroIntensity merged 1 commit into
python:mainfrom
flofriday:improve-getopt-coverage
Jul 18, 2026
Merged

Improve getopt and unix_getopt test coverage#153933
ZeroIntensity merged 1 commit into
python:mainfrom
flofriday:improve-getopt-coverage

Conversation

@flofriday

Copy link
Copy Markdown
Contributor

In both getopt() and gnu_getopt() tests were missing for -- to pass the remainder of the args as 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.

@python-cla-bot

python-cla-bot Bot commented Jul 18, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Jul 18, 2026
@bedevere-app

bedevere-app Bot commented Jul 18, 2026

Copy link
Copy Markdown

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 skip news label instead.

@encukou encukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-project-automation github-project-automation Bot moved this to Todo in Sprint Jul 18, 2026
@flofriday
flofriday force-pushed the improve-getopt-coverage branch from cd76d9e to 8d42f3e Compare July 18, 2026 12:37
@flofriday
flofriday requested a review from encukou July 18, 2026 12:40

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in Sprint Jul 18, 2026
@ZeroIntensity ZeroIntensity added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jul 18, 2026
@ZeroIntensity
ZeroIntensity enabled auto-merge (squash) July 18, 2026 13:36
@ZeroIntensity
ZeroIntensity merged commit 0fa144b into python:main Jul 18, 2026
96 of 99 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Sprint Jul 18, 2026
@miss-islington-app

Copy link
Copy Markdown

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.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jul 18, 2026

Copy link
Copy Markdown

GH-153972 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jul 18, 2026
@miss-islington-app

Copy link
Copy Markdown

Sorry, @flofriday and @ZeroIntensity, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 0fa144bb78042fb91c703678bb378b4dbce3cb95 3.13

@bedevere-app

bedevere-app Bot commented Jul 18, 2026

Copy link
Copy Markdown

GH-153973 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 18, 2026
@bedevere-app

bedevere-app Bot commented Jul 18, 2026

Copy link
Copy Markdown

GH-153975 is a backport of this pull request to the 3.13 branch.

@ZeroIntensity

ZeroIntensity commented Jul 18, 2026

Copy link
Copy Markdown
Member

Something seems to be broken on 3.13, so let's skip the 3.13 backport.

encukou pushed a commit that referenced this pull request Jul 18, 2026
…H-153933) (GH-153972)

(cherry picked from commit 0fa144b)

Co-authored-by: Florian Freitag <flohacksfriday@gmail.com>
encukou pushed a commit that referenced this pull request Jul 18, 2026
…H-153933) (GH-153973)

(cherry picked from commit 0fa144b)

Co-authored-by: Florian Freitag <flohacksfriday@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants