diff options
Diffstat (limited to '')
-rw-r--r-- | tests/test_builders/test_build_texinfo.py (renamed from tests/test_build_texinfo.py) | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/tests/test_build_texinfo.py b/tests/test_builders/test_build_texinfo.py index 9964382..f9effb2 100644 --- a/tests/test_build_texinfo.py +++ b/tests/test_builders/test_build_texinfo.py @@ -1,6 +1,5 @@ """Test the build process with Texinfo builder with the test root.""" -import os import re import subprocess from pathlib import Path @@ -11,37 +10,14 @@ import pytest from sphinx.builders.texinfo import default_texinfo_documents from sphinx.config import Config -from sphinx.testing.util import strip_escseq from sphinx.util.docutils import new_document from sphinx.writers.texinfo import TexinfoTranslator -from .test_build_html import ENV_WARNINGS - -TEXINFO_WARNINGS = ENV_WARNINGS + """\ -%(root)s/index.rst:\\d+: WARNING: unknown option: '&option' -%(root)s/index.rst:\\d+: WARNING: citation not found: missing -%(root)s/index.rst:\\d+: WARNING: a suitable image for texinfo builder not found: foo.\\* -%(root)s/index.rst:\\d+: WARNING: a suitable image for texinfo builder not found: \ -\\['application/pdf', 'image/svg\\+xml'\\] \\(svgimg.\\*\\) -""" - - -@pytest.mark.sphinx('texinfo', testroot='warnings', freshenv=True) -def test_texinfo_warnings(app, status, warning): - app.builder.build_all() - warnings = strip_escseq(re.sub(re.escape(os.sep) + '{1,2}', '/', warning.getvalue())) - warnings_exp = TEXINFO_WARNINGS % { - 'root': re.escape(app.srcdir.as_posix())} - assert re.match(warnings_exp + '$', warnings), \ - "Warnings don't match:\n" + \ - '--- Expected (regex):\n' + warnings_exp + \ - '--- Got:\n' + warnings - @pytest.mark.sphinx('texinfo') def test_texinfo(app, status, warning): TexinfoTranslator.ignore_missing_images = True - app.builder.build_all() + app.build(force_all=True) result = (app.outdir / 'sphinxtests.texi').read_text(encoding='utf8') assert ('@anchor{markup doc}@anchor{11}' '@anchor{markup id1}@anchor{12}' @@ -71,7 +47,7 @@ def test_texinfo_rubric(app, status, warning): @pytest.mark.sphinx('texinfo', testroot='markup-citation') def test_texinfo_citation(app, status, warning): - app.builder.build_all() + app.build(force_all=True) output = (app.outdir / 'python.texi').read_text(encoding='utf8') assert 'This is a citation ref; @ref{1,,[CITE1]} and @ref{2,,[CITE2]}.' in output @@ -84,7 +60,6 @@ def test_texinfo_citation(app, status, warning): def test_default_texinfo_documents(): config = Config({'project': 'STASI™ Documentation', 'author': "Wolfgang Schäuble & G'Beckstein"}) - config.init_values() expected = [('index', 'stasi', 'STASI™ Documentation', "Wolfgang Schäuble & G'Beckstein", 'stasi', 'One line description of project', 'Miscellaneous')] @@ -110,7 +85,7 @@ def test_texinfo_escape_id(app, status, warning): @pytest.mark.sphinx('texinfo', testroot='footnotes') def test_texinfo_footnote(app, status, warning): - app.builder.build_all() + app.build(force_all=True) output = (app.outdir / 'python.texi').read_text(encoding='utf8') assert 'First footnote: @footnote{\nFirst\n}' in output @@ -118,13 +93,13 @@ def test_texinfo_footnote(app, status, warning): @pytest.mark.sphinx('texinfo') def test_texinfo_xrefs(app, status, warning): - app.builder.build_all() + app.build(force_all=True) output = (app.outdir / 'sphinxtests.texi').read_text(encoding='utf8') assert re.search(r'@ref{\w+,,--plugin\.option}', output) # Now rebuild it without xrefs app.config.texinfo_cross_references = False - app.builder.build_all() + app.build(force_all=True) output = (app.outdir / 'sphinxtests.texi').read_text(encoding='utf8') assert not re.search(r'@ref{\w+,,--plugin\.option}', output) assert 'Link to perl +p, --ObjC++, --plugin.option, create-auth-token, arg and -j' in output |