Bug 1898139 - python-sphinx fails to build with Python 3.10: Test failures, different reprs
Summary: python-sphinx fails to build with Python 3.10: Test failures, different reprs
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-sphinx
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1909494
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2020-11-16 13:57 UTC by Miro Hrončok
Modified: 2021-01-19 13:07 UTC (History)
6 users (show)

Fixed In Version: python-sphinx-1:3.4.3-1.fc34
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-01-19 13:07:08 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Miro Hrončok 2020-11-16 13:57:49 UTC
python-sphinx fails to build with Python 3.10.0a2.

________________________ test_autodoc_imported_members _________________________

app = <SphinxTestApp buildername='html'>

    @pytest.mark.sphinx('html', testroot='ext-autodoc')
    def test_autodoc_imported_members(app):
        options = {"members": None,
                   "imported-members": None,
                   "ignore-module-all": None}
        actual = do_autodoc(app, 'module', 'target', options)
>       assert '.. py:function:: save_traceback(app: Sphinx) -> str' in actual
E       AssertionError: assert '.. py:function:: save_traceback(app: Sphinx) -> str' in StringList(['', '.. py:module:: target', '', '', '.. py:class:: Class(arg)', '   :module: target', '', '   Class to do...back', 0), ('/tmp/pytest-of-mockbuild/pytest-0/ext-autodoc/target/__init__.py:docstring of target.save_traceback', 1)])

tests/test_ext_autodoc.py:652: AssertionError
--------------------------- Captured stdout teardown ---------------------------
# testroot: root
# builder: html
# srcdir: /tmp/pytest-of-mockbuild/pytest-0/ext-autodoc
# outdir: /tmp/pytest-of-mockbuild/pytest-0/ext-autodoc/_build/html
# status: 
[01mRunning Sphinx v3.2.1[39;49;00m

# warning: 

__________________________ test_autodoc_TYPE_CHECKING __________________________

app = <SphinxTestApp buildername='html'>

    @pytest.mark.skipif(sys.version_info < (3, 6), reason='py36+ is required.')
    @pytest.mark.sphinx('html', testroot='ext-autodoc')
    def test_autodoc_TYPE_CHECKING(app):
        options = {"members": None,
                   "undoc-members": None}
        actual = do_autodoc(app, 'module', 'target.TYPE_CHECKING', options)
>       assert list(actual) == [
            '',
            '.. py:module:: target.TYPE_CHECKING',
            '',
            '',
            '.. py:class:: Foo()',
            '   :module: target.TYPE_CHECKING',
            '',
            '',
            '   .. py:attribute:: Foo.attr1',
            '      :module: target.TYPE_CHECKING',
            '      :type: StringIO',
            '',
        ]
E       assert ['', '.. py:m...HECKING', ...] == ['', '.. py:m...HECKING', ...]
E         At index 10 diff: "      :type: 'StringIO'" != '      :type: StringIO'
E         Use -v to get the full diff

tests/test_ext_autodoc.py:1749: AssertionError
--------------------------- Captured stdout teardown ---------------------------
# testroot: root
# builder: html
# srcdir: /tmp/pytest-of-mockbuild/pytest-0/ext-autodoc
# outdir: /tmp/pytest-of-mockbuild/pytest-0/ext-autodoc/_build/html
# status: 
[01mRunning Sphinx v3.2.1[39;49;00m

# warning: 

_______________________ test_autodoc_typehints_signature _______________________

app = <SphinxTestApp buildername='html'>

    @pytest.mark.sphinx('html', testroot='ext-autodoc',
                        confoverrides={'autodoc_typehints': "signature"})
    def test_autodoc_typehints_signature(app):
        options = {"members": None,
                   "undoc-members": True}
        actual = do_autodoc(app, 'module', 'target.typehints', options)
>       assert list(actual) == [
            '',
            '.. py:module:: target.typehints',
            '',
            '',
            '.. py:class:: Math(s: str, o: object = None)',
            '   :module: target.typehints',
            '',
            '',
            '   .. py:method:: Math.decr(a: int, b: int = 1) -> int',
            '      :module: target.typehints',
            '',
            '',
            '   .. py:method:: Math.horse(a: str, b: int) -> None',
            '      :module: target.typehints',
            '',
            '',
            '   .. py:method:: Math.incr(a: int, b: int = 1) -> int',
            '      :module: target.typehints',
            '',
            '',
            '   .. py:method:: Math.nothing() -> None',
            '      :module: target.typehints',
            '',
            '',
            '.. py:class:: NewAnnotation(i: int)',
            '   :module: target.typehints',
            '',
            '',
            '.. py:class:: NewComment(i: int)',
            '   :module: target.typehints',
            '',
            '',
            '.. py:class:: SignatureFromMetaclass(a: int)',
            '   :module: target.typehints',
            '',
            '',
            '.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '
            'Union[str, Unknown]] = None, *args: str, **kwargs: str) -> None',
            '   :module: target.typehints',
            '',
            '',
            '.. py:function:: decr(a: int, b: int = 1) -> int',
            '   :module: target.typehints',
            '',
            '',
            '.. py:function:: incr(a: int, b: int = 1) -> int',
            '   :module: target.typehints',
            '',
            '',
            '.. py:function:: missing_attr(c, a: str, b: Optional[str] = None) -> str',
            '   :module: target.typehints',
            '',
            '',
            '.. py:function:: tuple_args(x: Tuple[int, Union[int, str]]) -> Tuple[int, int]',
            '   :module: target.typehints',
            '',
        ]
E       AssertionError: assert ['', '.. py:m...pehints', ...] == ['', '.. py:m...pehints', ...]
E         At index 4 diff: '.. py:class:: Math(s: str, o: Optional[object] = None)' != '.. py:class:: Math(s: str, o: object = None)'
E         Use -v to get the full diff

tests/test_ext_autodoc_configs.py:488: AssertionError
--------------------------- Captured stdout teardown ---------------------------
# testroot: root
# builder: html
# srcdir: /tmp/pytest-of-mockbuild/pytest-0/ext-autodoc
# outdir: /tmp/pytest-of-mockbuild/pytest-0/ext-autodoc/_build/html
# status: 
[01mRunning Sphinx v3.2.1[39;49;00m
[01mloading pickled environment... [39;49;00mdone

# warning: 

__________________________ test_signature_annotations __________________________

    def test_signature_annotations():
        from typing_test_data import (f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10,
                                      f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, Node)
    
        # Class annotations
        sig = inspect.signature(f0)
        assert stringify_signature(sig) == '(x: int, y: numbers.Integral) -> None'
    
        # Generic types with concrete parameters
        sig = inspect.signature(f1)
        assert stringify_signature(sig) == '(x: List[int]) -> List[int]'
    
        # TypeVars and generic types with TypeVars
        sig = inspect.signature(f2)
        assert stringify_signature(sig) == '(x: List[T], y: List[T_co], z: T) -> List[T_contra]'
    
        # Union types
        sig = inspect.signature(f3)
        assert stringify_signature(sig) == '(x: Union[str, numbers.Integral]) -> None'
    
        # Quoted annotations
        sig = inspect.signature(f4)
        assert stringify_signature(sig) == '(x: str, y: str) -> None'
    
        # Keyword-only arguments
        sig = inspect.signature(f5)
        assert stringify_signature(sig) == '(x: int, *, y: str, z: str) -> None'
    
        # Keyword-only arguments with varargs
        sig = inspect.signature(f6)
        assert stringify_signature(sig) == '(x: int, *args, y: str, z: str) -> None'
    
        # Space around '=' for defaults
        sig = inspect.signature(f7)
>       assert stringify_signature(sig) == '(x: int = None, y: dict = {}) -> None'
E       AssertionError: assert '(x: Optional...= {}) -> None' == '(x: int = No...= {}) -> None'
E         - (x: int = None, y: dict = {}) -> None
E         + (x: Optional[int] = None, y: dict = {}) -> None
E         ?     +++++++++   +

tests/test_util_inspect.py:165: AssertionError
=========================== short test summary info ============================
FAILED tests/test_ext_autodoc.py::test_autodoc_imported_members - AssertionEr...
FAILED tests/test_ext_autodoc.py::test_autodoc_TYPE_CHECKING - assert ['', '....
FAILED tests/test_ext_autodoc_configs.py::test_autodoc_typehints_signature - ...
FAILED tests/test_util_inspect.py::test_signature_annotations - AssertionErro...
===== 4 failed, 1537 passed, 2 skipped, 7 deselected in 147.98s (0:02:27) ======

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

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

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 Charalampos Stratakis 2021-01-15 12:44:50 UTC
Python 3.10 related issues from upstream:

https://github.com/sphinx-doc/sphinx/pull/8397

https://github.com/sphinx-doc/sphinx/pull/8376


Note You need to log in before you can comment on or make changes to this bug.