Skip to content

Conversation

@bearomorphism
Copy link
Collaborator

@bearomorphism bearomorphism commented Dec 13, 2025

Test improvements

  1. Addressed the issues about missing skip_below_py_3_13 and missing forced consistent environment variables to reduce the chance of unnecessary file regression test failures.
  2. Extracted duplicated logics.

@codecov
Copy link

codecov bot commented Dec 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (v4-11-0@2072f8e). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             v4-11-0    #1726   +/-   ##
==========================================
  Coverage           ?   97.84%           
==========================================
  Files              ?       60           
  Lines              ?     2604           
  Branches           ?        0           
==========================================
  Hits               ?     2548           
  Misses             ?       56           
  Partials           ?        0           
Flag Coverage Δ
unittests 97.84% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines -22 to -25
skip_below_py_3_13 = pytest.mark.skipif(
sys.version_info < (3, 13),
reason="The output message of argparse is different between Python 3.13 and lower than Python 3.13",
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The variable name itself does not reflect why we want to set this variable... this may make it hard for future contributors to understand the code correctly

Comment on lines +41 to +46
monkeypatch.setenv("COLUMNS", "80")
monkeypatch.setenv("TERM", "dumb")
monkeypatch.setenv("LC_ALL", "C")
monkeypatch.setenv("LANG", "C")
monkeypatch.setenv("NO_COLOR", "1")
monkeypatch.setenv("PAGER", "cat")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copied from AI output. I know COLUMNS is necessary, but not sure for the rest

@bearomorphism
Copy link
Collaborator Author

@woile @Lee-W could you review this PR when you have a moment? This PR contains the resolution of error when someone is trying to update CLI --help description. Some other PRs updating CLI options have dependencies on this PR.

Thanks!

@woile
Copy link
Member

woile commented Dec 14, 2025

I don't understand what this is supposed to fix

@bearomorphism
Copy link
Collaborator Author

I don't understand what this is supposed to fix

The behavior of --help of argparse is different in some cases between python 3.13 and below 3.13 as the message of original skip_below_py_3_13 says. Some of --help tests still uses skip_below_py_3_10 before this PR, and those tests still pass in the pipeline luckily.

When we try to add new options to the CLI, the help text changes, and usually we run pytest --regen-all to regenerate the file_regression test file, but the regenerated content may be different depends on the local environment (monkeypatch in this PR addresses this issue).

@bearomorphism
Copy link
Collaborator Author

The following pipeline result is a false alarm test failure caused by forgetting to skip the test below python 3.13.

https://github.com/commitizen-tools/commitizen/actions/runs/20207591917/job/58008470452?pr=1724

Test passes for python version 3.13, 3.14 but not on 3.10

This PR can fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants