Bug 2328009

Summary: python-grip fails to build with Python 3.14: AssertionError: assert '/usr/lib/pyt...e terminal.\n' == 'Usage:\n gr...e terminal.\n'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-gripAssignee: Sandro <gui1ty>
Status: CLOSED NOTABUG QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: gui1ty, ksurma, mhroncok, neuro-sig
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: 2024-12-01 19:26:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2322407    

Description Karolina Surma 2024-11-22 11:08:14 UTC
python-grip fails to build with Python 3.14.0a2.

__________________________________ test_help ___________________________________

    def test_help():
>       assert run('-h') == usage
E       AssertionError: assert '/usr/lib/pyt...e terminal.\n' == 'Usage:\n  gr...e terminal.\n'
E         
E         + /usr/lib/python3.14/site-packages/docopt.py:165: SyntaxWarning: invalid escape sequence '\S'
E         +   name = re.findall('(<\S*?>)', source)[0]
E         + /usr/lib/python3.14/site-packages/docopt.py:166: SyntaxWarning: invalid escape sequence '\['
E         +   value = re.findall('\[default: (.*)\]', source, flags=re.I)
E         + /usr/lib/python3.14/site-packages/docopt.py:207: SyntaxWarning: invalid escape sequence '\['
E         +   matched = re.findall('\[default: (.*)\]', description, flags=re.I)...
E         
E         ...Full output truncated (37 lines hidden), use '-vv' to show

tests/test_cli.py:41: AssertionError
_________________________________ test_version _________________________________

    def test_version():
>       assert run('-V') == version + '\n'
E       AssertionError: assert '/usr/lib/pyt...nGrip 4.6.2\n' == 'Grip 4.6.2\n'
E         
E         + /usr/lib/python3.14/site-packages/docopt.py:165: SyntaxWarning: invalid escape sequence '\S'
E         +   name = re.findall('(<\S*?>)', source)[0]
E         + /usr/lib/python3.14/site-packages/docopt.py:166: SyntaxWarning: invalid escape sequence '\['
E         +   value = re.findall('\[default: (.*)\]', source, flags=re.I)
E         + /usr/lib/python3.14/site-packages/docopt.py:207: SyntaxWarning: invalid escape sequence '\['
E         +   matched = re.findall('\[default: (.*)\]', description, flags=re.I)...
E         
E         ...Full output truncated (5 lines hidden), use '-vv' to show

tests/test_cli.py:46: AssertionError
_______________________________ test_bad_command _______________________________

    def test_bad_command():
        simple_usage = '\n\n'.join(usage.split('\n\n')[:1])
        with pytest.raises(CalledProcessError) as excinfo:
            run('--does-not-exist')
>       assert excinfo.value.output == simple_usage + '\n'
E       AssertionError: assert '/usr/lib/pyt...-h | --help\n' == 'Usage:\n  gr...-h | --help\n'
E         
E         + /usr/lib/python3.14/site-packages/docopt.py:165: SyntaxWarning: invalid escape sequence '\S'
E         +   name = re.findall('(<\S*?>)', source)[0]
E         + /usr/lib/python3.14/site-packages/docopt.py:166: SyntaxWarning: invalid escape sequence '\['
E         +   value = re.findall('\[default: (.*)\]', source, flags=re.I)
E         + /usr/lib/python3.14/site-packages/docopt.py:207: SyntaxWarning: invalid escape sequence '\['
E         +   matched = re.findall('\[default: (.*)\]', description, flags=re.I)...
E         
E         ...Full output truncated (8 lines hidden), use '-vv' to show

tests/test_cli.py:54: AssertionError
=========================== short test summary info ============================
FAILED tests/test_cli.py::test_help - AssertionError: assert '/usr/lib/pyt......
FAILED tests/test_cli.py::test_version - AssertionError: assert '/usr/lib/pyt...
FAILED tests/test_cli.py::test_bad_command - AssertionError: assert '/usr/lib...
=================== 3 failed, 13 passed, 5 warnings in 2.19s ===================

https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08291663-python-grip/

For all our attempts to build python-grip with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-grip/

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.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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 Sandro 2024-12-01 14:28:55 UTC
I just tried a local mock build using the Copr configuration and all tests passed:

============================= test session starts ==============================
platform linux -- Python 3.14.0a2, pytest-8.3.3, pluggy-1.5.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /builddir/build/BUILD/python-grip-4.6.2-build/grip-ed3adea5a2f32af8062a97917e26a61dfe9fb589
configfile: pytest.ini
collecting ... collected 16 items

tests/test_api.py::test_exceptions PASSED                                [  6%]
tests/test_api.py::test_readme_reader PASSED                             [ 12%]
tests/test_api.py::test_directory_reader PASSED                          [ 18%]
tests/test_api.py::test_text_reader PASSED                               [ 25%]
tests/test_api.py::test_stdin_reader PASSED                              [ 31%]
tests/test_api.py::test_readme_renderer PASSED                           [ 37%]
tests/test_api.py::test_github_renderer PASSED                           [ 43%]
tests/test_api.py::test_offline_renderer PASSED                          [ 50%]
tests/test_api.py::test_readme_asset_manager PASSED                      [ 56%]
tests/test_api.py::test_github_asset_manager PASSED                      [ 62%]
tests/test_api.py::test_app PASSED                                       [ 68%]
tests/test_api.py::test_api PASSED                                       [ 75%]
tests/test_api.py::test_command PASSED                                   [ 81%]
tests/test_cli.py::test_help PASSED                                      [ 87%]
tests/test_cli.py::test_version PASSED                                   [ 93%]
tests/test_cli.py::test_bad_command PASSED                               [100%]

============================== 16 passed in 2.20s ==============================

Though, I did notice a change, which appears to be related:

https://github.com/python/cpython/issues/66436

In the What's New that's described as:

The default value of the program name for `argparse.ArgumentParser` now reflects the way the Python interpreter was instructed to find the __main__ module code.

This looks like a Copr specific issue. Yet, I have no idea how to troubleshoot this further. Moreover, this seems to have worked just fine with 3.14.0a1:

https://copr.fedorainfracloud.org/coprs/g/python/python3.14/build/8258756/

Comment 2 Miro HronĨok 2024-12-01 19:26:11 UTC
I've restarted the build a couple times and it suceeded.