File: test_docutilsconf.py

package info (click to toggle)
sphinx 4.5.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 22,656 kB
  • sloc: python: 74,641; javascript: 14,242; perl: 420; makefile: 247; sh: 57; xml: 19; ansic: 1
file content (29 lines) | stat: -rw-r--r-- 1,084 bytes parent folder | download | duplicates (10)
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
"""Test docutils.conf support for several writers."""

import pytest
from docutils import nodes

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


@pytest.mark.sphinx('dummy', testroot='docutilsconf', freshenv=True)
def test_html_with_default_docutilsconf(app, status, warning):
    with patch_docutils(app.confdir):
        app.build()

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


@pytest.mark.sphinx('dummy', testroot='docutilsconf', freshenv=True,
                    docutilsconf=('[restructuredtext parser]\n'
                                  'trim_footnote_reference_space: true\n'))
def test_html_with_docutilsconf(app, status, warning):
    with patch_docutils(app.confdir):
        app.build()

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