Skip to content

Bug: test_invalid_command fails on Python 3.12 #1864

@lostinth1cho

Description

@lostinth1cho

Description

The test_invalid_command fails specifically on Python 3.12. Interestingly, the test passes as expected on Python 3.10, 3.11, 3.13, and 3.14.

On Python 3.12, argparse produces an error message with single quotes around choices, but our current regression reference for 3.12 expects the "no-quote" format (which is the standard in 3.13+). This inconsistency causes a mismatch only in the 3.12 environment.

Steps to reproduce

  1. Use a Python 3.12.3 environment.
  2. Run the test suite:
    uv run pytest tests/test_cli.py::test_invalid_command
  3. Observe the AssertionError from file_regression.check.

Current behavior

The test fails because the obtained output contains single quotes around the valid choices, whereas the reference file does not.
Diff output:

Image

Desired behavior

The regression files for Python 3.12 should be standardized. We need to decide whether Python 3.12 should strictly follow the "no quotes" format or if the reference files need an update to accommodate the specific minor version of Python 3.12 being used.

Screenshots

Image Image

Environment

Commitizen Version: 4.13.6
Python Version:

  • Python 3.10.19, PASS
  • Python 3.11.14, PASS
  • Python 3.12.3, FAIL
  • Python 3.13.12, PASS
  • Python 3.14.3, PASS

Operating System: Linux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions