summaryrefslogtreecommitdiff
path: root/tests/test_build_texinfo.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-09-21 17:17:02 +0200
committerGeorg Brandl <georg@python.org>2014-09-21 17:17:02 +0200
commit9d4d2075518f900a4b294c76fbbe55469b9329f5 (patch)
tree08d92669490358b284d2edd9ba4d61b64c52042a /tests/test_build_texinfo.py
parent675ee673d9e982a4b975d36630ff3af5ddceccd6 (diff)
downloadsphinx-9d4d2075518f900a4b294c76fbbe55469b9329f5.tar.gz
Complete test suite overhaul.
* rename a few test modules to make the names more consistent * do not copy/use Sphinx from build/ (unnecessary without 2to3) * use a temporary dir for *all* test projects, the source tree will stay pristine that way (default is tests/build) * speed up tests by ~3x by splitting up test projects and avoiding rebuilds
Diffstat (limited to 'tests/test_build_texinfo.py')
-rw-r--r--tests/test_build_texinfo.py24
1 files changed, 9 insertions, 15 deletions
diff --git a/tests/test_build_texinfo.py b/tests/test_build_texinfo.py
index fbe8a173..7f50857f 100644
--- a/tests/test_build_texinfo.py
+++ b/tests/test_build_texinfo.py
@@ -14,20 +14,14 @@ import os
import re
from subprocess import Popen, PIPE
-from six import PY3, StringIO
+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.\\*'
@@ -38,17 +32,17 @@ 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', freshenv=True)
+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)