Skip to content

Modernize Lib/test/test_decimal.py: use argparse instead of optparse #143984

@tonghuaroot

Description

@tonghuaroot

Feature or enhancement

Proposal:

Description

Lib/test/test_decimal.py currently uses the deprecated optparse module for parsing command-line arguments. This task involves migrating it to use argparse.

Proposed Changes

  • Replace optparse imports with argparse.
  • Update argument parsing logic to use argparse.ArgumentParser.
  • Ensure all existing command-line options (--debug, --skip) are supported.
  • Fix any formatting issues (e.g. % in help strings).

Verification

  • Run python Lib/test/test_decimal.py --help
  • Run python Lib/test/test_decimal.py --skip

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-refactorCode refactoring (with no changes in behavior)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions