mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
use test generator nosetests feature.
This commit is contained in:
parent
91709946d6
commit
e2ed97031d
@ -9,68 +9,37 @@
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
from util import with_app, test_root, path, SkipTest
|
||||
from util import with_app, test_root, path, SkipTest, TestApp
|
||||
from textwrap import dedent
|
||||
|
||||
try:
|
||||
from docutils.writers.manpage import Writer as ManWriter
|
||||
except ImportError:
|
||||
ManWriter = None
|
||||
|
||||
|
||||
builder_names = ['pickle', 'json', 'linkcheck', 'text', 'htmlhelp', 'qthelp',
|
||||
'epub', 'changes', 'singlehtml', 'xml', 'pseudoxml']
|
||||
|
||||
|
||||
def teardown_module():
|
||||
(test_root / '_build').rmtree(True)
|
||||
|
||||
# just let the remaining ones run for now
|
||||
|
||||
@with_app(buildername='pickle')
|
||||
def test_pickle(app):
|
||||
app.builder.build_all()
|
||||
def test_build():
|
||||
for buildername in builder_names:
|
||||
app = TestApp(buildername=buildername)
|
||||
yield lambda app: app.builder.build_all(), app
|
||||
app.cleanup()
|
||||
|
||||
@with_app(buildername='json')
|
||||
def test_json(app):
|
||||
app.builder.build_all()
|
||||
|
||||
@with_app(buildername='linkcheck')
|
||||
def test_linkcheck(app):
|
||||
app.builder.build_all()
|
||||
|
||||
@with_app(buildername='text')
|
||||
def test_text(app):
|
||||
app.builder.build_all()
|
||||
|
||||
@with_app(buildername='htmlhelp')
|
||||
def test_htmlhelp(app):
|
||||
app.builder.build_all()
|
||||
|
||||
@with_app(buildername='qthelp')
|
||||
def test_qthelp(app):
|
||||
app.builder.build_all()
|
||||
|
||||
@with_app(buildername='epub')
|
||||
def test_epub(app):
|
||||
app.builder.build_all()
|
||||
|
||||
@with_app(buildername='changes')
|
||||
def test_changes(app):
|
||||
app.builder.build_all()
|
||||
|
||||
try:
|
||||
from docutils.writers.manpage import Writer
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
@with_app(buildername='man')
|
||||
def test_man(app):
|
||||
@with_app(buildername='man')
|
||||
def test_man(app):
|
||||
if ManWriter is None:
|
||||
raise SkipTest('man writer is not available')
|
||||
app.builder.build_all()
|
||||
assert (app.outdir / 'SphinxTests.1').exists()
|
||||
|
||||
@with_app(buildername='singlehtml', cleanenv=True)
|
||||
def test_singlehtml(app):
|
||||
app.builder.build_all()
|
||||
|
||||
@with_app(buildername='xml')
|
||||
def test_xml(app):
|
||||
app.builder.build_all()
|
||||
|
||||
@with_app(buildername='pseudoxml')
|
||||
def test_pseudoxml(app):
|
||||
app.builder.build_all()
|
||||
|
||||
@with_app(buildername='html', srcdir='(temp)')
|
||||
def test_nonascii_path(app):
|
||||
|
@ -186,6 +186,9 @@ class TestApp(application.Sphinx):
|
||||
for tree in self.cleanup_trees:
|
||||
shutil.rmtree(tree, True)
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s buildername=%r>' % (self.__class__.__name__, self.builder.name)
|
||||
|
||||
|
||||
def with_app(*args, **kwargs):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user