Bug 1981556

Summary: python-sphinx %check fails with Python 3.10.0b4+: Enum changes were reverted in Python 3.10
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-sphinxAssignee: Karolina Surma <ksurma>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: aviso, cstratak, dradez, mhroncok, python-sig, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://koschei.fedoraproject.org/package/python-sphinx
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-07-26 07:38:15 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: 1890881, 1927309    

Description Miro Hrončok 2021-07-12 19:40:26 UTC
Description of problem:
Package python-sphinx fails to build from source in Fedora rawhide after we upgraded to Python 3.10.0b4+.

=================================== FAILURES ===================================
_______________________________ test_enum_class ________________________________
app = <SphinxTestApp buildername='html'>
    @pytest.mark.sphinx('html', testroot='ext-autodoc')
    def test_enum_class(app):
        options = {"members": None}
        actual = do_autodoc(app, 'class', 'target.enums.EnumCls', options)
    
        if sys.version_info < (3, 10):
            sig = '(value)'
        else:
            sig = ('(value, names=None, *, module=None, qualname=None, type=None, start=1, '
                   'boundary=None)')
    
>       assert list(actual) == [
            '',
            '.. py:class:: EnumCls%s' % sig,
            '   :module: target.enums',
            '',
            '   this is enum class',
            '',
            '',
            '   .. py:method:: EnumCls.say_goodbye()',
            '      :module: target.enums',
            '      :classmethod:',
            '',
            '      a classmethod says good-bye to you.',
            '',
            '',
            '   .. py:method:: EnumCls.say_hello()',
            '      :module: target.enums',
            '',
            '      a method says hello to you.',
            '',
            '',
            '   .. py:attribute:: EnumCls.val1',
            '      :module: target.enums',
            '      :value: 12',
            '',
            '      doc for val1',
            '',
            '',
            '   .. py:attribute:: EnumCls.val2',
            '      :module: target.enums',
            '      :value: 23',
            '',
            '      doc for val2',
            '',
            '',
            '   .. py:attribute:: EnumCls.val3',
            '      :module: target.enums',
            '      :value: 34',
            '',
            '      doc for val3',
            '',
        ]
E       AssertionError: assert ['', '.. py:c...ass', '', ...] == ['', '.. py:c...ass', '', ...]
E         At index 1 diff: '.. py:class:: EnumCls(value)' != '.. py:class:: EnumCls(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)'
E         Use -v to get the full diff
tests/test_ext_autodoc.py:1380: AssertionError

Version-Release number of selected component (if applicable):
4.0.2-3.fc35

Steps to Reproduce:
fedpkg build

Additional info:
This package is tracked by Koschei. See:
https://koschei.fedoraproject.org/package/python-sphinx

This is caused by a revert of enum changes in Python 3.10.0b4. The code seems to have a if sys.version_info < (3, 10) conditional and we just need to adapt that.

Context: https://mail.python.org/archives/list/python-dev@python.org/message/LSTMFAPSPD3BGZ4D6HQFODXZVB3PLYKF/

Comment 1 Karolina Surma 2021-07-13 07:44:01 UTC
The proposed solution solves FTBFS (https://copr.fedorainfracloud.org/coprs/ksurma/sphinx-4.1.0/build/2326945/), so I've opened an issue and sent PR upstream.

Comment 2 Karolina Surma 2021-07-26 07:38:15 UTC
The fix will be included in Sphinx 4.1.2.