René's URL Explorer Experiment


Title: test(cli): skip invalid-command snapshot on Python 3.12.0-3.12.6 by bearomorphism · Pull Request #1982 · commitizen-tools/commitizen · GitHub

Open Graph Title: test(cli): skip invalid-command snapshot on Python 3.12.0-3.12.6 by bearomorphism · Pull Request #1982 · commitizen-tools/commitizen

X Title: test(cli): skip invalid-command snapshot on Python 3.12.0-3.12.6 by bearomorphism · Pull Request #1982 · commitizen-tools/commitizen

Description: Description Closes #1864. Why tests/test_cli.py::test_invalid_command is a snapshot test that captures the stderr output of cz . The output is generated by argparse, and CPython 3.13 changed the format of the invalid choice: error from quoted choices ('init', 'commit', ...) to unquoted (init, commit, ...) — see CPython gh-129019. The change was backported to 3.12.7. The repo's reference snapshots reflect the no-quote format, so: Python Quoted? Snapshot match? 3.10.x, 3.11.x yes yes (snapshots use quotes) 3.12.0 - 3.12.6 yes no — test fails 3.12.7+, 3.13.x, 3.14.x no yes (snapshots use no quotes) A user on 3.12.3 hits AssertionError: FILES DIFFER running pytest tests/test_cli.py::test_invalid_command. The CI matrix runs on a recent 3.12.x, so CI doesn't catch it. What changed File Change tests/test_cli.py Add pytest.mark.skipif(sys.version_info[:2] == (3, 12) and sys.version_info < (3, 12, 7), reason=...) to the test_invalid_command parametrised test. The reason text references CPython gh-129019 and this issue. How it works The first guard sys.version_info[:2] == (3, 12) scopes the skip to Python 3.12.x only — older 3.10/3.11 (which still print quoted choices) and newer 3.13/3.14 (which print unquoted) are unaffected. The second guard sys.version_info < (3, 12, 7) uses Python's lexicographic tuple comparison: (3, 12, 6, ...) < (3, 12, 7) is True, (3, 12, 7, ...) < (3, 12, 7) is False. So 3.12.0 through 3.12.6 skip; 3.12.7+ run. The --invalid-arg parametrised case shares the same decorator. Its argparse path also formats choices, so the same skip logic applies even though the diff message is slightly different. 3.10 / 3.11 snapshots use quotes, so they would also break if argparse's no-quote change is back-ported to those branches. However, both are in security-only maintenance (3.10 is EOL, 3.11 since April 2024), and a formatting-only change won't be merged under that policy. We don't need to skip 3.10/3.11. Why a skipif instead of duplicate snapshots? A skipif is cheaper to maintain (no new fixture file, no risk of the duplicate snapshot drifting). It's also more honest: argparse's behaviour on 3.12.0-3.12.6 is a known upstream issue, fixed in 3.12.7. Users on those patches can upgrade; we don't need commitizen to keep accumulating fixtures for upstream's old behaviour. Backward compatibility Test-only change. No behaviour change for cz users. The CI matrix (Ubuntu/macOS/Windows × 3.10/3.11/3.12/3.13/3.14) continues to exercise test_invalid_command on every supported Python because the GitHub-hosted runners use a recent patch within each minor (3.12.10+ at the time of writing). Checklist I have read the contributing guidelines Was generative AI tooling used to co-author this PR? Yes (please specify the tool below) Generated-by: Claude following the guidelines Code Changes Add test cases to all the changes you introduce (this PR is a test-only change; the regression itself is the existing snapshot, the fix is the skip) Run uv run poe all locally to ensure this change passes linter check and tests (poe lint clean; verified the test runs on a recent 3.12.x and skips on an old one — see "Steps to Test") Manually test the changes (see "Steps to Test" below) Update the documentation for the changes (no doc change required — this is a test-fixture compatibility fix) Expected Behavior Python interpreter pytest tests/test_cli.py -k test_invalid_command 3.10.x runs and passes (snapshot uses quotes, argparse uses quotes) 3.11.x runs and passes (same) 3.12.0 - 3.12.6 skipped with the gh-129019 rationale 3.12.7+ runs and passes (snapshot has no quotes, argparse has no quotes) 3.13.x runs and passes (same) 3.14.x runs and passes (same) Steps to Test This Pull Request git fetch fork fix/1864-skip-old-3.12-argparse-snapshot git checkout fork/fix/1864-skip-old-3.12-argparse-snapshot # 1. On a recent 3.12 patch (any 3.12.7+) — both parametrised cases run and pass. uv run --python 3.12 pytest tests/test_cli.py::test_invalid_command -v # expected: 2 passed # 2. On an old 3.12 patch (where argparse still quotes) — both are skipped with the gh-129019 reason. uv run --python 3.12.3 pytest tests/test_cli.py::test_invalid_command -v # expected: 2 skipped (with the rationale visible in -v output) # 3. On every other supported Python — same as before, no skip. for py in 3.10 3.11 3.13 3.14 ; do uv run --python "$py" pytest tests/test_cli.py::test_invalid_command -v done # expected: 2 passed for each # 4. Full test_cli.py suite (sanity check that nothing else broke). uv run pytest tests/test_cli.py -q # expected: 22 passed, 1 skipped (on old 3.12) OR 23 passed (on a recent 3.12 / other versions) Additional Context Surfaced while triaging open issues in #1976 (round 3). The original reporter and @noirbizarre (the assignee) had already discussed skipping the test on 3.12 — this PR scopes that skip to the affected patch range so the test still runs on every patch where the snapshot is valid. Reviewed by an internal claude-sonnet-4.6 code-review pass and by GitHub Copilot; both confirmed the version-tuple comparison and that the 3.10/3.11 snapshots are safe (security-only maintenance precludes the same back-port there).

Open Graph Description: Description Closes #1864. Why tests/test_cli.py::test_invalid_command is a snapshot test that captures the stderr output of cz <invalid>. The output is generated by argparse, and CPython 3.13...

X Description: Description Closes #1864. Why tests/test_cli.py::test_invalid_command is a snapshot test that captures the stderr output of cz &lt;invalid&gt;. The output is generated by argparse, and CPyt...

Opengraph URL: https://github.com/commitizen-tools/commitizen/pull/1982

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:bd1a4bd0-b2c5-4417-0fc3-86b4ab3508ca
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9F94:2C03D:1D49B0F:2863DA3:6A4EBA1F
html-safe-nonced8ef6fd308588fec64e01fe7ee1841a8792d6587fb6dd5114b39768dc2bc9905
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Rjk0OjJDMDNEOjFENDlCMEY6Mjg2M0RBMzo2QTRFQkExRiIsInZpc2l0b3JfaWQiOiI3MDY0NTI3MzA4Nzg3MjAyNTkxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3ba263caaf8f4b9030a81ff3e80e67ec530aeb19f0a8099ac4eeda9f857401c2
hovercard-subject-tagpull_request:3654801386
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/commitizen-tools/commitizen/pull/1982/files
twitter:imagehttps://avatars.githubusercontent.com/u/26526132?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/26526132?s=400&v=4
og:image:altDescription Closes #1864. Why tests/test_cli.py::test_invalid_command is a snapshot test that captures the stderr output of cz <invalid>. The output is generated by argparse, and CPython 3.13...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/commitizen-tools/commitizen git https://github.com/commitizen-tools/commitizen.git
octolytics-dimension-user_id62252524
octolytics-dimension-user_logincommitizen-tools
octolytics-dimension-repository_id106127589
octolytics-dimension-repository_nwocommitizen-tools/commitizen
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id106127589
octolytics-dimension-repository_network_root_nwocommitizen-tools/commitizen
turbo-body-classeslogged-out env-production page-responsive
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee6a744804e8e70f97b4d5a18a94dcc63db22f97a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/commitizen-tools/commitizen/pull/1982/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcommitizen-tools%2Fcommitizen%2Fpull%2F1982%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcommitizen-tools%2Fcommitizen%2Fpull%2F1982%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=commitizen-tools%2Fcommitizen
Reloadhttps://github.com/commitizen-tools/commitizen/pull/1982/files
Reloadhttps://github.com/commitizen-tools/commitizen/pull/1982/files
Reloadhttps://github.com/commitizen-tools/commitizen/pull/1982/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1982/files
commitizen-tools https://github.com/commitizen-tools
commitizenhttps://github.com/commitizen-tools/commitizen
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1982/files
Notifications https://github.com/login?return_to=%2Fcommitizen-tools%2Fcommitizen
Fork 344 https://github.com/login?return_to=%2Fcommitizen-tools%2Fcommitizen
Star 3.5k https://github.com/login?return_to=%2Fcommitizen-tools%2Fcommitizen
Code https://github.com/commitizen-tools/commitizen
Issues 116 https://github.com/commitizen-tools/commitizen/issues
Pull requests 45 https://github.com/commitizen-tools/commitizen/pulls
Discussions https://github.com/commitizen-tools/commitizen/discussions
Actions https://github.com/commitizen-tools/commitizen/actions
Projects https://github.com/commitizen-tools/commitizen/projects
Security and quality 0 https://github.com/commitizen-tools/commitizen/security
Insights https://github.com/commitizen-tools/commitizen/pulse
Code https://github.com/commitizen-tools/commitizen
Issues https://github.com/commitizen-tools/commitizen/issues
Pull requests https://github.com/commitizen-tools/commitizen/pulls
Discussions https://github.com/commitizen-tools/commitizen/discussions
Actions https://github.com/commitizen-tools/commitizen/actions
Projects https://github.com/commitizen-tools/commitizen/projects
Security and quality https://github.com/commitizen-tools/commitizen/security
Insights https://github.com/commitizen-tools/commitizen/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fcommitizen-tools%2Fcommitizen%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fcommitizen-tools%2Fcommitizen%2Fissues%2Fnew%2Fchoose
bearomorphismhttps://github.com/bearomorphism
commitizen-tools:masterhttps://github.com/commitizen-tools/commitizen/tree/master
bearomorphism:fix/1864-skip-old-3.12-argparse-snapshothttps://github.com/bearomorphism/commitizen/tree/fix/1864-skip-old-3.12-argparse-snapshot
Conversation 3 https://github.com/commitizen-tools/commitizen/pull/1982
Commits 1 https://github.com/commitizen-tools/commitizen/pull/1982/commits
Checks 20 https://github.com/commitizen-tools/commitizen/pull/1982/checks
Files changed https://github.com/commitizen-tools/commitizen/pull/1982/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1982/files
test(cli): skip invalid-command snapshot on Python 3.12.0-3.12.6 https://github.com/commitizen-tools/commitizen/pull/1982/files#top
Show all changes 1 commit https://github.com/commitizen-tools/commitizen/pull/1982/files
831b8a8 test(cli): skip invalid-command snapshot on Python 3.12.0-3.12.6 bearomorphism May 9, 2026 https://github.com/commitizen-tools/commitizen/pull/1982/commits/831b8a8fd9d0b36b2b696b1bd039b9b38230908e
Clear filters https://github.com/commitizen-tools/commitizen/pull/1982/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1982/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1982/files
tests/test_cli.pyhttps://github.com/commitizen-tools/commitizen/pull/1982/files#diff-4e8715c7a425ee52e74b7df4d34efd32e8c92f3e60bd51bc2e1ad5943b82032e
View file https://github.com/bearomorphism/commitizen/blob/831b8a8fd9d0b36b2b696b1bd039b9b38230908e/tests/test_cli.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/commitizen-tools/commitizen/pull/1982/{{ revealButtonHref }}
https://github.com/commitizen-tools/commitizen/pull/1982/files#diff-4e8715c7a425ee52e74b7df4d34efd32e8c92f3e60bd51bc2e1ad5943b82032e
https://github.com/commitizen-tools/commitizen/pull/1982/files#diff-4e8715c7a425ee52e74b7df4d34efd32e8c92f3e60bd51bc2e1ad5943b82032e
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1982/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.