summaryrefslogtreecommitdiff
path: root/tests/test_build_texinfo.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_build_texinfo.py')
-rw-r--r--tests/test_build_texinfo.py56
1 files changed, 28 insertions, 28 deletions
diff --git a/tests/test_build_texinfo.py b/tests/test_build_texinfo.py
index d7b7e520a..d6ce8c536 100644
--- a/tests/test_build_texinfo.py
+++ b/tests/test_build_texinfo.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
test_build_texinfo
~~~~~~~~~~~~~~~~~~
@@ -8,17 +7,18 @@
:copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
-from __future__ import print_function
import os
import re
-from subprocess import Popen, PIPE
+import subprocess
+from subprocess import CalledProcessError, PIPE
import pytest
-from six import PY3
from test_build_html import ENV_WARNINGS
-from sphinx.testing.util import remove_unicode_literals, strip_escseq
+from sphinx.builders.texinfo import default_texinfo_documents
+from sphinx.config import Config
+from sphinx.testing.util import strip_escseq
from sphinx.writers.texinfo import TexinfoTranslator
@@ -30,9 +30,6 @@ TEXINFO_WARNINGS = ENV_WARNINGS + """\
\\['application/pdf', 'image/svg\\+xml'\\] \\(svgimg.\\*\\)
"""
-if PY3:
- TEXINFO_WARNINGS = remove_unicode_literals(TEXINFO_WARNINGS)
-
@pytest.mark.sphinx('texinfo', testroot='warnings', freshenv=True)
def test_texinfo_warnings(app, status, warning):
@@ -50,28 +47,21 @@ def test_texinfo_warnings(app, status, warning):
def test_texinfo(app, status, warning):
TexinfoTranslator.ignore_missing_images = True
app.builder.build_all()
- result = (app.outdir / 'SphinxTests.texi').text(encoding='utf8')
- assert ('@anchor{markup doc}@anchor{12}'
- '@anchor{markup id1}@anchor{13}'
- '@anchor{markup testing-various-markup}@anchor{14}' in result)
+ result = (app.outdir / 'sphinxtests.texi').text(encoding='utf8')
+ assert ('@anchor{markup doc}@anchor{11}'
+ '@anchor{markup id1}@anchor{12}'
+ '@anchor{markup testing-various-markup}@anchor{13}' in result)
+ assert 'Footnotes' not in result
# now, try to run makeinfo over it
- cwd = os.getcwd()
- os.chdir(app.outdir)
try:
- try:
- p = Popen(['makeinfo', '--no-split', 'SphinxTests.texi'],
- stdout=PIPE, stderr=PIPE)
- except OSError:
- raise pytest.skip.Exception # most likely makeinfo was not found
- else:
- stdout, stderr = p.communicate()
- retcode = p.returncode
- if retcode != 0:
- print(stdout)
- print(stderr)
- assert False, 'makeinfo exited with return code %s' % retcode
- finally:
- os.chdir(cwd)
+ args = ['makeinfo', '--no-split', 'sphinxtests.texi']
+ subprocess.run(args, stdout=PIPE, stderr=PIPE, cwd=app.outdir, check=True)
+ except OSError:
+ raise pytest.skip.Exception # most likely makeinfo was not found
+ except CalledProcessError as exc:
+ print(exc.stdout)
+ print(exc.stderr)
+ assert False, 'makeinfo exited with return code %s' % exc.retcode
@pytest.mark.sphinx('texinfo', testroot='markup-rubric')
@@ -93,3 +83,13 @@ def test_texinfo_citation(app, status, warning):
'This is a citation\n') in output
assert ('@anchor{index cite2}@anchor{2}@w{(CITE2)} \n'
'This is a multiline citation\n') in output
+
+
+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')]
+ assert default_texinfo_documents(config) == expected