readthedocs / sphinx-autoapi

A new approach to API documentation in Sphinx.
https://sphinx-autoapi.readthedocs.io/
MIT License
415 stars 126 forks source link

`test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration` fails depending on (valid) sphinx version #368

Closed mjsir911 closed 1 year ago

mjsir911 commented 1 year ago

downstream ticket: https://bugs.gentoo.org/892607

2.0.0 2.0.1 / master
5.3.0
6.1.3
sphinx==6.1.3 and sphinx-autoapi==2.0.0 ``` sphinx-autoapi $ PYTHONPATH=. pytest -vv -ra -l -Wdefault --color=no tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration =========================================================================== test session starts ============================================================================ platform linux -- Python 3.11.1, pytest-7.2.1, pluggy-1.0.0 -- /usr/bin/python3.11 cachedir: .pytest_cache hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/tmp/tmp.FSj7kXyjIz/sphinx-autoapi/.hypothesis/examples') rootdir: /tmp/tmp.FSj7kXyjIz/sphinx-autoapi plugins: httpbin-1.0.2, hypothesis-6.62.1, expect-1.1.0, xdist-3.1.0, forked-1.4.0, regressions-2.4.1, shutil-1.7.0, pyfakefs-5.0.0, freezegun-0.4.2, subtests-0.9.0, pkgcore-0.12.17, datadir-1.4.1, httpserver-1.0.6, flaky-3.7.0, jaraco.test-5.3.0, timeout-2.1.0, virtualenv-1.7.0, anyio-3.6.1, xprocess-0.21.0, trio-0.8.0, asyncio-0.20.3, aiohttp-1.0.4, mock-3.10.0, rerunfailures-10.3 asyncio: mode=Mode.STRICT collected 1 item tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration FAILED [100%] ================================================================================= FAILURES ================================================================================= ____________________________________________________________ TestPositionalOnlyArgumentsModule.test_integration ____________________________________________________________ self = def test_integration(self): example_path = "_build/text/autoapi/example/index.txt" with io.open(example_path, encoding="utf8") as example_handle: example_file = example_handle.read() assert "f_simple(a, b, /, c, d, *, e, f)" in example_file > assert ( "f_comment(a: int, b: int, /, c: Optional[int], d: Optional[int], *, e: float, f: float)" in example_file ) E assert 'f_comment(a: int, b: int, /, c: Optional[int], d: Optional[int], *, e: float, f: float)' in '"example"\n*********\n\nExample module\n\nThis is a description\n\n\nModule Contents\n===============\n\n\nFunctions\n---------\n\n+------------+--------------------------------------------------------------------------------------------+\n| "f_simple | |\n| "(a, b, /, | |\n| c, d, *, | |\n| e, f) | |\n+------------+--------------------------------------------------------------------------------------------+\n| "f_commen | |\n| t"(→ None) | |\n+------------+--------------------------------------------------------------------------------------------+\n| "f_annota | |\n| tion"(→ | |\n| None) | |\n+------------+--------------------------------------------------------------------------------------------+\n| "f_arg_co | |\n| mment"(→ | |\n| None) | |\n+------------+--------------------------------------------------------------------------------------------+\n| "f_no_cd" | |\n| (a, b, /, | |\n| *, e, f) | |\n+------------+--------------------------------------------------------------------------------------------+\n\nexample.f_simple(a, b, /, c, d, *, e, f)\n\nexample.f_comment(a: int, b: int, /, c: int | None, d: int | None, *, e: float, f: float) -> None\n\nexample.f_annotation(a: int, b: int, /, c: int | None, d: int | None, *, e: float, f: float) -> None\n\nexample.f_arg_comment(a: int, b: int, /, c: int | None, d: int | None, *, e: float, f: float) -> None\n\nexample.f_no_cd(a: int, b: int, /, *, e: float, f: float)\n' example_file = ('"example"\n' '*********\n' '\n' 'Example module\n' '\n' 'This is a description\n' '\n' '\n' 'Module Contents\n' '===============\n' '\n' '\n' 'Functions\n' '---------\n' '\n' '+------------+--------------------------------------------------------------------------------------------+\n' '| "f_simple ' '| ' '|\n' '| "(a, b, /, ' '| ' '|\n' '| c, d, *, ' '| ' '|\n' '| e, f) ' '| ' '|\n' '+------------+--------------------------------------------------------------------------------------------+\n' '| "f_commen ' '| ' '|\n' '| t"(→ None) ' '| ' '|\n' '+------------+--------------------------------------------------------------------------------------------+\n' '| "f_annota ' '| ' '|\n' '| tion"(→ ' '| ' '|\n' '| None) ' '| ' '|\n' '+------------+--------------------------------------------------------------------------------------------+\n' '| "f_arg_co ' '| ' '|\n' '| mment"(→ ' '| ' '|\n' '| None) ' '| ' '|\n' '+------------+--------------------------------------------------------------------------------------------+\n' '| "f_no_cd" ' '| ' '|\n' '| (a, b, /, ' '| ' '|\n' '| *, e, f) ' '| ' '|\n' '+------------+--------------------------------------------------------------------------------------------+\n' '\n' 'example.f_simple(a, b, /, c, d, *, e, f)\n' '\n' 'example.f_comment(a: int, b: int, /, c: int | None, d: int | None, *, e: ' 'float, f: float) -> None\n' '\n' 'example.f_annotation(a: int, b: int, /, c: int | None, d: int | None, *, e: ' 'float, f: float) -> None\n' '\n' 'example.f_arg_comment(a: int, b: int, /, c: int | None, d: int | None, *, e: ' 'float, f: float) -> None\n' '\n' 'example.f_no_cd(a: int, b: int, /, *, e: float, f: float)\n') example_handle = <_io.TextIOWrapper name='_build/text/autoapi/example/index.txt' mode='r' encoding='utf8'> example_path = '_build/text/autoapi/example/index.txt' self = /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/tests/python/test_pyintegration.py:391: AssertionError -------------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------------- Running Sphinx v6.1.3 making output directory... done [AutoAPI] Reading files... [100%] /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/tests/python/py38positionalparams/example/example.py [AutoAPI] Mapping Data... [100%] /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/tests/python/py38positionalparams/example/example.py [AutoAPI] Rendering Data... [100%] example [autosummary] generating autosummary for: index.rst building [mo]: targets for 0 po files that are out of date writing output... building [text]: targets for 1 source files that are out of date updating environment: [new config] 3 added, 0 changed, 0 removed reading sources... [100%] index looking for now-outdated files... none found pickling environment... done checking consistency... done preparing documents... done writing output... [100%] index build succeeded. The text files are in _build/text. ============================================================================= warnings summary ============================================================================= ../../../usr/lib/python3.11/site-packages/sphinx/util/images.py:6 /usr/lib/python3.11/site-packages/sphinx/util/images.py:6: DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13 import imghdr tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /usr/lib/python3.11/importlib/__init__.py:126: RemovedInSphinx80Warning: The alias 'sphinx.util.SkipProgressMessage' is deprecated, use 'sphinx.util.display.SkipProgressMessage' instead. Check CHANGES for Sphinx API modifications. return _bootstrap._gcd_import(name[level:], package, level) tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /usr/lib/python3.11/importlib/__init__.py:126: RemovedInSphinx80Warning: The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.util.display.progress_message' instead. Check CHANGES for Sphinx API modifications. return _bootstrap._gcd_import(name[level:], package, level) tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/autoapi/extension.py:164: RemovedInSphinx80Warning: The alias 'sphinx.util.status_iterator' is deprecated, use 'sphinx.util.display.status_iterator' instead. Check CHANGES for Sphinx API modifications. if sphinx_mapper_obj.load( tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /usr/lib/python3.11/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py:313: DeprecationWarning: The 'Module.doc' attribute is deprecated, use 'Module.doc_node' instead. warnings.warn( tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /usr/lib/python3.11/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py:1415: DeprecationWarning: The 'FunctionDef.doc' attribute is deprecated, use 'FunctionDef.doc_node' instead. warnings.warn( tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/autoapi/mappers/python/mapper.py:350: RemovedInSphinx80Warning: The alias 'sphinx.util.status_iterator' is deprecated, use 'sphinx.util.display.status_iterator' instead. Check CHANGES for Sphinx API modifications. super(PythonSphinxMapper, self).map(options) tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/autoapi/extension.py:170: RemovedInSphinx80Warning: The alias 'sphinx.util.status_iterator' is deprecated, use 'sphinx.util.display.status_iterator' instead. Check CHANGES for Sphinx API modifications. sphinx_mapper_obj.output_rst(root=normalized_root, source_suffix=out_suffix) tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/autoapi/toctree.py:124: PendingDeprecationWarning: nodes.Node.traverse() is obsoleted by Node.findall(). for desc_node in doctree.traverse(addnodes.desc): tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/autoapi/toctree.py:59: PendingDeprecationWarning: nodes.Node.traverse() is obsoleted by Node.findall(). for check_node in toc.traverse(nodes.reference): tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/autoapi/toctree.py:29: DeprecationWarning: nodes.Text: initialization argument "rawsource" is ignored and will be removed in Docutils 2.0. *[nodes.Text(text, text)] tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/autoapi/extension.py:203: PendingDeprecationWarning: nodes.Node.traverse() is obsoleted by Node.findall(). nodes = list(doctree.traverse(toctree)) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ========================================================================= short test summary info ========================================================================== FAILED tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration - assert 'f_comment(a: int, b: int, /, c: Optional[int], d: Optional[int],... ====================================================================== 1 failed, 14 warnings in 1.30s ====================================================================== pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo().terminate()'. ```
sphinx==5.3.0 and sphinx-autoapi==2.0.1 ``` sphinx-autoapi $ PYTHONPATH=. pytest -vv -ra -l -Wdefault --color=no tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration =========================================================================== test session starts ============================================================================ platform linux -- Python 3.11.1, pytest-7.2.1, pluggy-1.0.0 -- /usr/bin/python3.11 cachedir: .pytest_cache hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/tmp/tmp.FSj7kXyjIz/sphinx-autoapi/.hypothesis/examples') rootdir: /tmp/tmp.FSj7kXyjIz/sphinx-autoapi plugins: httpbin-1.0.2, hypothesis-6.62.1, expect-1.1.0, xdist-3.1.0, forked-1.4.0, regressions-2.4.1, shutil-1.7.0, pyfakefs-5.0.0, freezegun-0.4.2, subtests-0.9.0, pkgcore-0.12.17, datadir-1.4.1, httpserver-1.0.6, flaky-3.7.0, jaraco.test-5.3.0, timeout-2.1.0, virtualenv-1.7.0, anyio-3.6.1, xprocess-0.21.0, trio-0.8.0, asyncio-0.20.3, aiohttp-1.0.4, mock-3.10.0, rerunfailures-10.3 asyncio: mode=Mode.STRICT collected 1 item tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration FAILED [100%] ================================================================================= FAILURES ================================================================================= ____________________________________________________________ TestPositionalOnlyArgumentsModule.test_integration ____________________________________________________________ self = def test_integration(self): example_path = "_build/text/autoapi/example/index.txt" with io.open(example_path, encoding="utf8") as example_handle: example_file = example_handle.read() assert "f_simple(a, b, /, c, d, *, e, f)" in example_file if sys.version_info >= (3, 8): > assert ( "f_comment(a: int, b: int, /, c: int | None, d: int | None, *, e: float, f: float)" in example_file ) E assert 'f_comment(a: int, b: int, /, c: int | None, d: int | None, *, e: float, f: float)' in '"example"\n*********\n\nExample module\n\nThis is a description\n\n\nModule Contents\n===============\n\n\nFunctions\n---------\n\n+------------+--------------------------------------------------------------------------------------------+\n| "f_simple | |\n| "(a, b, /, | |\n| c, d, *, | |\n| e, f) | |\n+------------+--------------------------------------------------------------------------------------------+\n| "f_commen | |\n| t"(→ None) | |\n+------------+--------------------------------------------------------------------------------------------+\n| "f_annota | |\n| tion"(→ | |\n| None) | |\n+------------+--------------------------------------------------------------------------------------------+\n| "f_arg_co | |\n| mment"(→ | |\n| None) | |\n+------------+--------------------------------------------------------------------------------------------+\n| "f_no_cd" | |\n| (a, b, /, | |\n| *, e, f) | |\n+------------+--------------------------------------------------------------------------------------------+\n\nexample.f_simple(a, b, /, c, d, *, e, f)\n\nexample.f_comment(a: int, b: int, /, c: Optional[int], d: Optional[int], *, e: float, f: float) -> None\n\nexample.f_annotation(a: int, b: int, /, c: Optional[int], d: Optional[int], *, e: float, f: float) -> None\n\nexample.f_arg_comment(a: int, b: int, /, c: Optional[int], d: Optional[int], *, e: float, f: float) -> None\n\nexample.f_no_cd(a: int, b: int, /, *, e: float, f: float)\n' example_file = ('"example"\n' '*********\n' '\n' 'Example module\n' '\n' 'This is a description\n' '\n' '\n' 'Module Contents\n' '===============\n' '\n' '\n' 'Functions\n' '---------\n' '\n' '+------------+--------------------------------------------------------------------------------------------+\n' '| "f_simple ' '| ' '|\n' '| "(a, b, /, ' '| ' '|\n' '| c, d, *, ' '| ' '|\n' '| e, f) ' '| ' '|\n' '+------------+--------------------------------------------------------------------------------------------+\n' '| "f_commen ' '| ' '|\n' '| t"(→ None) ' '| ' '|\n' '+------------+--------------------------------------------------------------------------------------------+\n' '| "f_annota ' '| ' '|\n' '| tion"(→ ' '| ' '|\n' '| None) ' '| ' '|\n' '+------------+--------------------------------------------------------------------------------------------+\n' '| "f_arg_co ' '| ' '|\n' '| mment"(→ ' '| ' '|\n' '| None) ' '| ' '|\n' '+------------+--------------------------------------------------------------------------------------------+\n' '| "f_no_cd" ' '| ' '|\n' '| (a, b, /, ' '| ' '|\n' '| *, e, f) ' '| ' '|\n' '+------------+--------------------------------------------------------------------------------------------+\n' '\n' 'example.f_simple(a, b, /, c, d, *, e, f)\n' '\n' 'example.f_comment(a: int, b: int, /, c: Optional[int], d: Optional[int], *, ' 'e: float, f: float) -> None\n' '\n' 'example.f_annotation(a: int, b: int, /, c: Optional[int], d: Optional[int], ' '*, e: float, f: float) -> None\n' '\n' 'example.f_arg_comment(a: int, b: int, /, c: Optional[int], d: Optional[int], ' '*, e: float, f: float) -> None\n' '\n' 'example.f_no_cd(a: int, b: int, /, *, e: float, f: float)\n') example_handle = <_io.TextIOWrapper name='_build/text/autoapi/example/index.txt' mode='r' encoding='utf8'> example_path = '_build/text/autoapi/example/index.txt' self = /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/tests/python/test_pyintegration.py:409: AssertionError -------------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------------- Running Sphinx v5.3.0 making output directory... done [AutoAPI] Reading files... [100%] /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/tests/python/py38positionalparams/example/example.py [AutoAPI] Mapping Data... [100%] /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/tests/python/py38positionalparams/example/example.py [AutoAPI] Rendering Data... [100%] example [autosummary] generating autosummary for: index.rst building [mo]: targets for 0 po files that are out of date building [text]: targets for 1 source files that are out of date updating environment: [new config] 3 added, 0 changed, 0 removed reading sources... [100%] index looking for now-outdated files... none found pickling environment... done checking consistency... done preparing documents... done writing output... [100%] index build succeeded. The text files are in _build/text. ============================================================================= warnings summary ============================================================================= ../../../usr/lib/python3.11/site-packages/sphinx/util/images.py:4 /usr/lib/python3.11/site-packages/sphinx/util/images.py:4: DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13 import imghdr tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /usr/lib/python3.11/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py:313: DeprecationWarning: The 'Module.doc' attribute is deprecated, use 'Module.doc_node' instead. warnings.warn( tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /usr/lib/python3.11/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py:1415: DeprecationWarning: The 'FunctionDef.doc' attribute is deprecated, use 'FunctionDef.doc_node' instead. warnings.warn( tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/autoapi/toctree.py:124: PendingDeprecationWarning: nodes.Node.traverse() is obsoleted by Node.findall(). for desc_node in doctree.traverse(addnodes.desc): tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/autoapi/toctree.py:59: PendingDeprecationWarning: nodes.Node.traverse() is obsoleted by Node.findall(). for check_node in toc.traverse(nodes.reference): tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/autoapi/toctree.py:29: DeprecationWarning: nodes.Text: initialization argument "rawsource" is ignored and will be removed in Docutils 2.0. *[nodes.Text(text, text)] tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration /tmp/tmp.FSj7kXyjIz/sphinx-autoapi/autoapi/extension.py:193: PendingDeprecationWarning: nodes.Node.traverse() is obsoleted by Node.findall(). nodes = list(doctree.traverse(toctree)) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ========================================================================= short test summary info ========================================================================== FAILED tests/python/test_pyintegration.py::TestPositionalOnlyArgumentsModule::test_integration - assert 'f_comment(a: int, b: int, /, c: int | None, d: int | None, *, e:... ====================================================================== 1 failed, 9 warnings in 1.52s ======================================================================= pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo().terminate()'. ```

38496609 is related.

It's probably not too important to backport a failing test fix to 2.0.0, I'll just have it pinned to below <sphinx-6.0, but you probably want to update the test for current versions while setup.cfg still specifies a minimum version below 6.0