Skip to content

Mark tests as expected failures on Docutils 0.22.0rc2 #13547

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

Merged
merged 3 commits into from
May 12, 2025
Merged
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
7 changes: 7 additions & 0 deletions tests/test_directives/test_directive_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@
import re
from typing import TYPE_CHECKING

import docutils
import pytest
from docutils import nodes

if TYPE_CHECKING:
from sphinx.testing.util import SphinxTestApp

xfail_du_22 = pytest.mark.xfail(
docutils.__version_info__ >= (0, 22, 0, 'alpha', 0),
reason='expected failure on Docutils 0.22+',
)


@xfail_du_22
@pytest.mark.sphinx('text', testroot='directive-only')
def test_sectioning(app: SphinxTestApp) -> None:
def getsects(section):
Expand Down
9 changes: 9 additions & 0 deletions tests/test_environment/test_environment_toctree.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from typing import TYPE_CHECKING

import docutils
import pytest
from docutils import nodes
from docutils.nodes import bullet_list, list_item, literal, reference, title
Expand All @@ -17,7 +18,13 @@
if TYPE_CHECKING:
from sphinx.testing.util import SphinxTestApp

xfail_du_22 = pytest.mark.xfail(
docutils.__version_info__ >= (0, 22, 0, 'alpha', 0),
reason='expected failure on Docutils 0.22+',
)


@xfail_du_22
@pytest.mark.sphinx('xml', testroot='toctree')
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
def test_process_doc(app):
Expand Down Expand Up @@ -464,6 +471,7 @@ def test_domain_objects_document_scoping(app: SphinxTestApp) -> None:
)


@xfail_du_22
@pytest.mark.sphinx('xml', testroot='toctree')
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
def test_document_toc(app):
Expand Down Expand Up @@ -521,6 +529,7 @@ def test_document_toc(app):
assert_node(toctree[2][0], [compact_paragraph, reference, 'Indices and tables'])


@xfail_du_22
@pytest.mark.sphinx('xml', testroot='toctree')
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
def test_document_toc_only(app):
Expand Down
9 changes: 9 additions & 0 deletions tests/test_util/test_util_docutils_sphinx_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from types import SimpleNamespace

import docutils
import pytest
from docutils import nodes
from docutils.parsers.rst.languages import en as english # type: ignore[attr-defined]
from docutils.parsers.rst.states import (
Expand All @@ -14,6 +16,11 @@

from sphinx.util.docutils import SphinxDirective, new_document

xfail_du_22 = pytest.mark.xfail(
docutils.__version_info__ >= (0, 22, 0, 'alpha', 0),
reason='expected failure on Docutils 0.22+',
)


def make_directive(
*, env: SimpleNamespace, input_lines: StringList | None = None
Expand Down Expand Up @@ -104,6 +111,7 @@ def test_sphinx_directive_get_location() -> None:
assert directive.get_location() == '<source>:1'


@xfail_du_22
def test_sphinx_directive_parse_content_to_nodes() -> None:
directive = make_directive(env=SimpleNamespace())
content = 'spam\n====\n\nEggs! *Lobster thermidor.*'
Expand All @@ -120,6 +128,7 @@ def test_sphinx_directive_parse_content_to_nodes() -> None:
assert node.children[1].astext() == 'Eggs! Lobster thermidor.'


@xfail_du_22
def test_sphinx_directive_parse_text_to_nodes() -> None:
directive = make_directive(env=SimpleNamespace())
content = 'spam\n====\n\nEggs! *Lobster thermidor.*'
Expand Down
Loading