Bug 1914138

Summary: python-cliff fails to build with Python 3.10: argparse output has changed
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-cliffAssignee: Fedora Infrastructure SIG <infra-sig>
Status: ASSIGNED --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: apevec, infra-sig, jcapitao, kevin, mhroncok, openstack-sig, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1890881    

Description Tomáš Hrnčiar 2021-01-08 08:23:26 UTC
python-cliff fails to build with Python 3.10.0a4.

======================================================================
FAIL: test_show_help_for_help (cliff.tests.test_help.TestHelp)
cliff.tests.test_help.TestHelp.test_show_help_for_help
----------------------------------------------------------------------
testtools.testresult.real._StringException: Empty attachments:
  stderr
  stdout

Traceback (most recent call last):
  File "/builddir/build/BUILD/cliff-3.5.0/cliff/tests/test_help.py", line 107, in test_show_help_for_help
    self.assertIn('optional arguments:\n  --version', help_text)
  File "/usr/lib/python3.10/site-packages/testtools/testcase.py", line 397, in assertIn
    self.assertThat(haystack, Contains(needle), message)
  File "/usr/lib/python3.10/site-packages/testtools/testcase.py", line 478, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: 'optional arguments:\n  --version' not in "usage: setup.py [--version] [-v | -q] [--log-file LOG_FILE] [-h] [--debug]\n\ntesting\n\noptions:\n  --version            show program's version number and exit\n  -v, --verbose        Increase verbosity of output. Can be repeated.\n  -q, --quiet          Suppress output except warnings and errors.\n  --log-file LOG_FILE  Specify a file to log output. Disabled by default.\n  -h, --help           Show help message and exit.\n  --debug              Show tracebacks on errors.\n\nCommands:\n  complete       print bash completion command\n  help           print detailed help for another command\n  one            Test command.\n  three word command  Test command.\n  two words      Test command.\n"


----------------------------------------------------------------------
Ran 204 tests in 0.451s

FAILED (failures=1)
Test failed: <unittest.runner.TextTestResult run=204 errors=0 failures=1>
error: Test failed: <unittest.runner.TextTestResult run=204 errors=0 failures=1>

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01865080-python-cliff/

For all our attempts to build python-cliff with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-cliff/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Kevin Fenzi 2021-01-11 01:12:47 UTC
Odd. I am not sure why this would be failing in 3.10. 

On 3.9, the 'optional arguments:\n --version' does seem to be there/pass. 

Did python 3.10 change something about optional arguments?

Comment 2 Miro Hrončok 2021-01-11 08:53:46 UTC
Yes indeed the output has changed from:


  optional arguments:


to:


  options:


I have only recently learned abut this change:

https://bugs.python.org/issue9694
https://bugs.python.org/issue42870

Comment 3 Ben Cotton 2021-02-09 15:38:04 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 4 jcapitao 2021-02-11 10:07:20 UTC
I proposed a patch upstream https://review.opendev.org/c/openstack/cliff/+/775091