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.py33
1 files changed, 14 insertions, 19 deletions
diff --git a/tests/test_build_texinfo.py b/tests/test_build_texinfo.py
index 2f519435..bb10f8fa 100644
--- a/tests/test_build_texinfo.py
+++ b/tests/test_build_texinfo.py
@@ -8,46 +8,41 @@
:copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
+from __future__ import print_function
import os
import re
-import sys
-from StringIO import StringIO
from subprocess import Popen, PIPE
+from six import PY3
+
from sphinx.writers.texinfo import TexinfoTranslator
-from util import test_root, SkipTest, remove_unicode_literals, with_app
+from util import SkipTest, remove_unicode_literals, with_app
from test_build_html import ENV_WARNINGS
-def teardown_module():
- (test_root / '_build').rmtree(True)
-
-
-texinfo_warnfile = StringIO()
-
TEXINFO_WARNINGS = ENV_WARNINGS + """\
None:None: WARNING: citation not found: missing
None:None: WARNING: no matching candidate for image URI u'foo.\\*'
None:None: WARNING: no matching candidate for image URI u'svgimg.\\*'
"""
-if sys.version_info >= (3, 0):
+if PY3:
TEXINFO_WARNINGS = remove_unicode_literals(TEXINFO_WARNINGS)
-@with_app(buildername='texinfo', warning=texinfo_warnfile, cleanenv=True)
-def test_texinfo(app):
+@with_app('texinfo')
+def test_texinfo(app, status, warning):
TexinfoTranslator.ignore_missing_images = True
app.builder.build_all()
- texinfo_warnings = texinfo_warnfile.getvalue().replace(os.sep, '/')
+ texinfo_warnings = warning.getvalue().replace(os.sep, '/')
texinfo_warnings_exp = TEXINFO_WARNINGS % {
- 'root': re.escape(app.srcdir.replace(os.sep, '/'))}
+ 'root': re.escape(app.srcdir.replace(os.sep, '/'))}
assert re.match(texinfo_warnings_exp + '$', texinfo_warnings), \
- 'Warnings don\'t match:\n' + \
- '--- Expected (regex):\n' + texinfo_warnings_exp + \
- '--- Got:\n' + texinfo_warnings
+ 'Warnings don\'t match:\n' + \
+ '--- Expected (regex):\n' + texinfo_warnings_exp + \
+ '--- Got:\n' + texinfo_warnings
# now, try to run makeinfo over it
cwd = os.getcwd()
os.chdir(app.outdir)
@@ -61,8 +56,8 @@ def test_texinfo(app):
stdout, stderr = p.communicate()
retcode = p.returncode
if retcode != 0:
- print stdout
- print stderr
+ print(stdout)
+ print(stderr)
del app.cleanup_trees[:]
assert False, 'makeinfo exited with return code %s' % retcode
finally: