fix: handle argparse changes in Python 3.14#661
Merged
Conversation
python/cpython#66436 causes `tests/unit/test_main.py::test_help` to fail on Python 3.14 as follows: ``` monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f549ac59a70>, capsys = <_pytest.capture.CaptureFixture object at 0x7f549ad9e660> @on_supported_platform def test_help(monkeypatch, capsys): # GIVEN monkeypatch.setattr(sys, "argv", ["auditwheel"]) # WHEN retval = main() # THEN assert retval is None captured = capsys.readouterr() > assert "usage: auditwheel [-h] [-V] [-v] command ..." in captured.out E assert 'usage: auditwheel [-h] [-V] [-v] command ...' in "usage: python3.14 -m pytest [-h] [-V] [-v] command ...\n\nCross-distro Python wheels.\n\npositional arguments:\n command\n show Audit a wheel for external shared library dependencies.\n repair Vendor in external shared library dependencies of a wheel. If\n multiple wheels are specified, an error processing one wheel\n will abort processing of subsequent wheels.\n lddtree Analyze a single ELF file (similar to ``ldd``).\n\noptions:\n -h, --help show this help message and exit\n -V, --version show program's version number and exit\n -v, --verbose Give more output. Option is additive\n" E + where "usage: python3.14 -m pytest [-h] [-V] [-v] command ...\n\nCross-distro Python wheels.\n\npositional arguments:\n command\n show Audit a wheel for external shared library dependencies.\n repair Vendor in external shared library dependencies of a wheel. If\n multiple wheels are specified, an error processing one wheel\n will abort processing of subsequent wheels.\n lddtree Analyze a single ELF file (similar to ``ldd``).\n\noptions:\n -h, --help show this help message and exit\n -V, --version show program's version number and exit\n -v, --verbose Give more output. Option is additive\n" = CaptureResult(out="usage: python3.14 -m pytest [-h] [-V] [-v] command ...\n\nCross-distro Python wheels.\n\npositional arguments:\n command\n show Audit a wheel for external shared library dependencies.\n repair Vendor in external shared library dependencies of a wheel. If\n multiple wheels are specified, an error processing one wheel\n will abort processing of subsequent wheels.\n lddtree Analyze a single ELF file (similar to ``ldd``).\n\noptions:\n -h, --help show this help message and exit\n -V, --version show program's version number and exit\n -v, --verbose Give more output. Option is additive\n", err='').out tests/unit/test_main.py:41: AssertionError ``` Monkey-patch things a bit harder so that the output is as we expect.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #661 +/- ##
=======================================
Coverage 95.24% 95.24%
=======================================
Files 22 22
Lines 1829 1829
Branches 343 343
=======================================
Hits 1742 1742
Misses 48 48
Partials 39 39 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
auvipy
approved these changes
Jan 1, 2026
mayeut
reviewed
Jan 2, 2026
Co-authored-by: Matthieu Darbois <mayeut@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
python/cpython#66436 causes
tests/unit/test_main.py::test_helpto fail on Python 3.14 as follows:Monkey-patch things a bit harder so that the output is as we expect.