1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
Description: Fix for test_render
Fix for path and AssertionError in test_render, revised xml file
for the updated sphinx.
Forwarded: not-needed
Author: Yogeswaran Umasankar <kd8mbd@gmail.com>
Last-Update: 2025-05-05
--- a/tests/test_render.py
+++ b/tests/test_render.py
@@ -1,5 +1,6 @@
"""Tests for the rendering."""
import io
+import os
from pathlib import Path
from textwrap import dedent
@@ -11,9 +12,8 @@ from autodoc2.render.myst_ import MystRe
from autodoc2.render.rst_ import RstRenderer
from autodoc2.utils import yield_modules
import pytest
+import sphinx
from sphinx.testing.util import SphinxTestApp
-from sphinx.testing.util import path as sphinx_path
-
@pytest.mark.parametrize(
"renderer,extension",
@@ -93,8 +93,8 @@ def test_sphinx_build(tmp_path: Path, wi
build = tmp_path / "build"
app = SphinxTestApp(
buildername="html",
- srcdir=sphinx_path(source),
- builddir=sphinx_path(build),
+ srcdir=Path(os.path.abspath(source)),
+ builddir=Path(os.path.abspath(build)),
warning=warnings,
)
try:
@@ -136,8 +136,8 @@ def test_sphinx_build(tmp_path: Path, wi
rebuild_warnings = io.StringIO()
rebuild_app = SphinxTestApp(
buildername="html",
- srcdir=sphinx_path(source),
- builddir=sphinx_path(build),
+ srcdir=Path(os.path.abspath(source)),
+ builddir=Path(os.path.abspath(build)),
warning=rebuild_warnings,
)
try:
@@ -209,8 +209,8 @@ def test_sphinx_build_directives(tmp_pat
build = tmp_path / "build"
app = SphinxTestApp(
buildername="html",
- srcdir=sphinx_path(source),
- builddir=sphinx_path(build),
+ srcdir=Path(os.path.abspath(source)),
+ builddir=Path(os.path.abspath(build)),
warning=warnings,
)
try:
@@ -223,6 +223,11 @@ def test_sphinx_build_directives(tmp_pat
doctree = app.env.get_doctree("index")
doctree["source"] = "index.rst"
content = "\n".join([line.rstrip() for line in doctree.pformat().splitlines()])
+ if sphinx.version_info < (8, 2):
+ content = content.replace(
+ '<desc_parameterlist multi_line_parameter_list="False"',
+ '<desc_parameterlist multi_line_parameter_list="False" multi_line_trailing_comma="True"',
+ )
file_regression.check(content, extension=".xml")
--- a/tests/test_render/test_sphinx_build_directives.xml
+++ b/tests/test_render/test_sphinx_build_directives.xml
@@ -1,4 +1,4 @@
-<document source="index.rst">
+<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<section ids="test" names="test">
<title>
Test
@@ -19,13 +19,13 @@
```
````
<index entries="('single',\ 'func()\ (in\ module\ package)',\ 'package.func',\ '',\ None)">
- <desc classes="py function" desctype="function" domain="py" nocontentsentry="False" noindex="False" noindexentry="False" objtype="function">
+ <desc classes="py function" desctype="function" domain="py" no-contents-entry="False" no-index="False" no-index-entry="False" no-typesetting="False" nocontentsentry="False" noindex="False" noindexentry="False" objtype="function">
<desc_signature _toc_name="func()" _toc_parts="('package', 'func')" class="" classes="sig sig-object" fullname="func" ids="package.func" module="package">
<desc_addname classes="sig-prename descclassname" xml:space="preserve">
package.
<desc_name classes="sig-name descname" xml:space="preserve">
func
- <desc_parameterlist xml:space="preserve">
+ <desc_parameterlist multi_line_parameter_list="False" multi_line_trailing_comma="True" xml:space="preserve">
<desc_parameter xml:space="preserve">
<desc_sig_name classes="n">
a
|