Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,6 @@ module = [
"tests.test_theming.test_theming",
# tests/test_transforms
"tests.test_transforms.test_transforms_post_transforms_images",
# tests/test_writers
"tests.test_writers.test_docutilsconf",
]
disallow_untyped_defs = false

Expand Down
17 changes: 13 additions & 4 deletions tests/test_writers/test_docutilsconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,32 @@

from __future__ import annotations

from typing import TYPE_CHECKING

import pytest
from docutils import nodes

from sphinx.testing.util import assert_node
from sphinx.util.docutils import patch_docutils

if TYPE_CHECKING:
from sphinx.application import Sphinx


@pytest.mark.sphinx(
'dummy',
testroot='docutilsconf',
freshenv=True,
)
def test_html_with_default_docutilsconf(app):
def test_html_with_default_docutilsconf(app: Sphinx) -> None:
with patch_docutils(app.confdir):
app.build()

doctree = app.env.get_doctree('index')
section = doctree[0]
assert isinstance(section, nodes.Element)
assert_node(
doctree[0][1], [nodes.paragraph, ('Sphinx ', [nodes.footnote_reference, '1'])]
section[1], [nodes.paragraph, ('Sphinx ', [nodes.footnote_reference, '1'])]
)


Expand All @@ -31,11 +38,13 @@ def test_html_with_default_docutilsconf(app):
docutils_conf='[restructuredtext parser]\ntrim_footnote_reference_space: true\n',
copy_test_root=True,
)
def test_html_with_docutilsconf(app):
def test_html_with_docutilsconf(app: Sphinx) -> None:
with patch_docutils(app.confdir):
app.build()

doctree = app.env.get_doctree('index')
section = doctree[0]
assert isinstance(section, nodes.Element)
assert_node(
doctree[0][1], [nodes.paragraph, ('Sphinx', [nodes.footnote_reference, '1'])]
section[1], [nodes.paragraph, ('Sphinx', [nodes.footnote_reference, '1'])]
)
Loading