Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test_enum_class with Python 3.13.0a5 #12202

Closed
befeleme opened this issue Mar 25, 2024 · 5 comments · Fixed by #12293
Closed

Failing test_enum_class with Python 3.13.0a5 #12202

befeleme opened this issue Mar 25, 2024 · 5 comments · Fixed by #12293
Labels

Comments

@befeleme
Copy link
Contributor

Describe the bug

I try to build sphinx in Fedora Linux 41 with Python 3.13.0a5.
test_enum_class fails.
repr of the Enum class has changed. Now there's names=<not given> instead of None. This is an expected change, see: python/cpython#116508 (comment)

_______________________________ 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[:2] >= (3, 12):
            args = ('(value, names=None, *values, module=None, '
                    'qualname=None, type=None, start=1, boundary=None)')
        elif sys.version_info[:2] >= (3, 11):
            args = ('(value, names=None, *, module=None, qualname=None, '
                    'type=None, start=1, boundary=None)')
        else:
            args = '(value)'
    
>       assert list(actual) == [
            '',
            '.. py:class:: EnumCls' + args,
            '   :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, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)' != '.. py:class:: EnumCls(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)'

How to Reproduce

Probably by running tests with Python 3.13.0a5, but I haven't tried it on the upstream code.

Environment Information

Sphinx 7.2.6

Sphinx extensions

No response

Additional context

No response

@picnixz
Copy link
Member

picnixz commented Mar 25, 2024

I fixed it in 7.3 but I cannot make a release because I don't have the credentials for that. So... I would suggest you to disable the test for 3.13 (sorry) or use HEAD (which contains the fix).

@picnixz
Copy link
Member

picnixz commented Mar 26, 2024

Closing the issue since it's fixed on HEAD (even if we did backports, I cannot make a pypi release ☹️)

@picnixz picnixz closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2024
@picnixz picnixz closed this as completed Mar 26, 2024
@jayaddison jayaddison reopened this Apr 17, 2024
@jayaddison
Copy link
Contributor

This seems to be occurring again, but only for a small number of our CI jobs. For example, there's a failure in test_enum_class here: https://github.com/sphinx-doc/sphinx/actions/runs/8714147101/job/23903993563#step:9:2869

The change from da0733b includes logic related to producing <not given> formatting for parameters in Py3.13+ ; I'm investigating that to see whether it is relevant for the failing CI pipelines.

@jayaddison
Copy link
Contributor

Ok; my current theory is that the relevant argument formatting -- I think an enum sentinel default value -- could have been backported to the recently-released Python 3.12.3 ; why that has only re-appeared post-7.3 release, I'm not yet certain.

@jayaddison
Copy link
Contributor

A deadsnakes build from the same batch of CI jobs, passed when using Python 3.12.2 when a similar job failed using Python 3.12.3.

As far as I can tell, both CI jobs used "3.12" as the Python version specification - initially that makes me wonder whether deadsnakes could serve differing versions (e.g. 3.12.2, 3.12.3) of those at job-time.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants