Merged revisions 65283,65303,65316-65317,65372-65375,65377,65380,65483-65485,65494 via svnmerge from
svn+ssh://pythondev@svn.python.org/doctools/branches/0.4.x
........
r65283 | georg.brandl | 2008-07-29 10:07:26 +0000 (Tue, 29 Jul 2008) | 2 lines
Update ez_setup.py.
........
r65303 | benjamin.peterson | 2008-07-30 12:35:34 +0000 (Wed, 30 Jul 2008) | 1 line
add a with_testapp decorator for test functions that passes the TestApp instance in a cleans up after it
........
r65316 | benjamin.peterson | 2008-07-30 23:12:07 +0000 (Wed, 30 Jul 2008) | 1 line
make the app for test_markup global to the module
........
r65317 | benjamin.peterson | 2008-07-30 23:31:29 +0000 (Wed, 30 Jul 2008) | 1 line
make TestApp.cleanup more aggressive
........
r65372 | georg.brandl | 2008-08-01 19:11:22 +0000 (Fri, 01 Aug 2008) | 2 lines
Add more tests, fix a few bugs in image handling.
........
r65373 | georg.brandl | 2008-08-01 19:28:33 +0000 (Fri, 01 Aug 2008) | 2 lines
Fix oversight.
........
r65374 | benjamin.peterson | 2008-08-01 19:36:32 +0000 (Fri, 01 Aug 2008) | 1 line
fix one broken test
........
r65375 | georg.brandl | 2008-08-01 19:41:11 +0000 (Fri, 01 Aug 2008) | 2 lines
Fix the handling of non-ASCII input in quickstart.
........
r65377 | georg.brandl | 2008-08-01 19:48:24 +0000 (Fri, 01 Aug 2008) | 2 lines
Allow REs in markup checks.
........
r65380 | georg.brandl | 2008-08-01 20:31:18 +0000 (Fri, 01 Aug 2008) | 2 lines
Don't rely on mtimes being different for changed files.
........
r65483 | georg.brandl | 2008-08-04 09:01:40 +0000 (Mon, 04 Aug 2008) | 4 lines
Add an "encoding" option to literalinclude.
Add tests for include directives.
........
r65484 | georg.brandl | 2008-08-04 09:11:17 +0000 (Mon, 04 Aug 2008) | 2 lines
Add changelog entry.
........
r65485 | georg.brandl | 2008-08-04 09:21:58 +0000 (Mon, 04 Aug 2008) | 2 lines
Fix markup.
........
r65494 | georg.brandl | 2008-08-04 16:34:59 +0000 (Mon, 04 Aug 2008) | 2 lines
Correctly use HTML file suffix in templates.
........
2008-08-04 12:01:15 -05:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
test_build
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
2010-01-17 05:29:00 -06:00
|
|
|
Test all builders that have no special checks.
|
Merged revisions 65283,65303,65316-65317,65372-65375,65377,65380,65483-65485,65494 via svnmerge from
svn+ssh://pythondev@svn.python.org/doctools/branches/0.4.x
........
r65283 | georg.brandl | 2008-07-29 10:07:26 +0000 (Tue, 29 Jul 2008) | 2 lines
Update ez_setup.py.
........
r65303 | benjamin.peterson | 2008-07-30 12:35:34 +0000 (Wed, 30 Jul 2008) | 1 line
add a with_testapp decorator for test functions that passes the TestApp instance in a cleans up after it
........
r65316 | benjamin.peterson | 2008-07-30 23:12:07 +0000 (Wed, 30 Jul 2008) | 1 line
make the app for test_markup global to the module
........
r65317 | benjamin.peterson | 2008-07-30 23:31:29 +0000 (Wed, 30 Jul 2008) | 1 line
make TestApp.cleanup more aggressive
........
r65372 | georg.brandl | 2008-08-01 19:11:22 +0000 (Fri, 01 Aug 2008) | 2 lines
Add more tests, fix a few bugs in image handling.
........
r65373 | georg.brandl | 2008-08-01 19:28:33 +0000 (Fri, 01 Aug 2008) | 2 lines
Fix oversight.
........
r65374 | benjamin.peterson | 2008-08-01 19:36:32 +0000 (Fri, 01 Aug 2008) | 1 line
fix one broken test
........
r65375 | georg.brandl | 2008-08-01 19:41:11 +0000 (Fri, 01 Aug 2008) | 2 lines
Fix the handling of non-ASCII input in quickstart.
........
r65377 | georg.brandl | 2008-08-01 19:48:24 +0000 (Fri, 01 Aug 2008) | 2 lines
Allow REs in markup checks.
........
r65380 | georg.brandl | 2008-08-01 20:31:18 +0000 (Fri, 01 Aug 2008) | 2 lines
Don't rely on mtimes being different for changed files.
........
r65483 | georg.brandl | 2008-08-04 09:01:40 +0000 (Mon, 04 Aug 2008) | 4 lines
Add an "encoding" option to literalinclude.
Add tests for include directives.
........
r65484 | georg.brandl | 2008-08-04 09:11:17 +0000 (Mon, 04 Aug 2008) | 2 lines
Add changelog entry.
........
r65485 | georg.brandl | 2008-08-04 09:21:58 +0000 (Mon, 04 Aug 2008) | 2 lines
Fix markup.
........
r65494 | georg.brandl | 2008-08-04 16:34:59 +0000 (Mon, 04 Aug 2008) | 2 lines
Correctly use HTML file suffix in templates.
........
2008-08-04 12:01:15 -05:00
|
|
|
|
2014-03-01 01:18:16 -06:00
|
|
|
:copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
|
2008-12-27 05:19:17 -06:00
|
|
|
:license: BSD, see LICENSE for details.
|
Merged revisions 65283,65303,65316-65317,65372-65375,65377,65380,65483-65485,65494 via svnmerge from
svn+ssh://pythondev@svn.python.org/doctools/branches/0.4.x
........
r65283 | georg.brandl | 2008-07-29 10:07:26 +0000 (Tue, 29 Jul 2008) | 2 lines
Update ez_setup.py.
........
r65303 | benjamin.peterson | 2008-07-30 12:35:34 +0000 (Wed, 30 Jul 2008) | 1 line
add a with_testapp decorator for test functions that passes the TestApp instance in a cleans up after it
........
r65316 | benjamin.peterson | 2008-07-30 23:12:07 +0000 (Wed, 30 Jul 2008) | 1 line
make the app for test_markup global to the module
........
r65317 | benjamin.peterson | 2008-07-30 23:31:29 +0000 (Wed, 30 Jul 2008) | 1 line
make TestApp.cleanup more aggressive
........
r65372 | georg.brandl | 2008-08-01 19:11:22 +0000 (Fri, 01 Aug 2008) | 2 lines
Add more tests, fix a few bugs in image handling.
........
r65373 | georg.brandl | 2008-08-01 19:28:33 +0000 (Fri, 01 Aug 2008) | 2 lines
Fix oversight.
........
r65374 | benjamin.peterson | 2008-08-01 19:36:32 +0000 (Fri, 01 Aug 2008) | 1 line
fix one broken test
........
r65375 | georg.brandl | 2008-08-01 19:41:11 +0000 (Fri, 01 Aug 2008) | 2 lines
Fix the handling of non-ASCII input in quickstart.
........
r65377 | georg.brandl | 2008-08-01 19:48:24 +0000 (Fri, 01 Aug 2008) | 2 lines
Allow REs in markup checks.
........
r65380 | georg.brandl | 2008-08-01 20:31:18 +0000 (Fri, 01 Aug 2008) | 2 lines
Don't rely on mtimes being different for changed files.
........
r65483 | georg.brandl | 2008-08-04 09:01:40 +0000 (Mon, 04 Aug 2008) | 4 lines
Add an "encoding" option to literalinclude.
Add tests for include directives.
........
r65484 | georg.brandl | 2008-08-04 09:11:17 +0000 (Mon, 04 Aug 2008) | 2 lines
Add changelog entry.
........
r65485 | georg.brandl | 2008-08-04 09:21:58 +0000 (Mon, 04 Aug 2008) | 2 lines
Fix markup.
........
r65494 | georg.brandl | 2008-08-04 16:34:59 +0000 (Mon, 04 Aug 2008) | 2 lines
Correctly use HTML file suffix in templates.
........
2008-08-04 12:01:15 -05:00
|
|
|
"""
|
|
|
|
|
2014-07-12 08:14:14 -05:00
|
|
|
from util import with_app, test_root, path, SkipTest, TestApp
|
2012-05-01 01:13:06 -05:00
|
|
|
from textwrap import dedent
|
2009-09-08 05:07:27 -05:00
|
|
|
|
2014-07-12 08:14:14 -05:00
|
|
|
try:
|
|
|
|
from docutils.writers.manpage import Writer as ManWriter
|
|
|
|
except ImportError:
|
|
|
|
ManWriter = None
|
Merged revisions 65283,65303,65316-65317,65372-65375,65377,65380,65483-65485,65494 via svnmerge from
svn+ssh://pythondev@svn.python.org/doctools/branches/0.4.x
........
r65283 | georg.brandl | 2008-07-29 10:07:26 +0000 (Tue, 29 Jul 2008) | 2 lines
Update ez_setup.py.
........
r65303 | benjamin.peterson | 2008-07-30 12:35:34 +0000 (Wed, 30 Jul 2008) | 1 line
add a with_testapp decorator for test functions that passes the TestApp instance in a cleans up after it
........
r65316 | benjamin.peterson | 2008-07-30 23:12:07 +0000 (Wed, 30 Jul 2008) | 1 line
make the app for test_markup global to the module
........
r65317 | benjamin.peterson | 2008-07-30 23:31:29 +0000 (Wed, 30 Jul 2008) | 1 line
make TestApp.cleanup more aggressive
........
r65372 | georg.brandl | 2008-08-01 19:11:22 +0000 (Fri, 01 Aug 2008) | 2 lines
Add more tests, fix a few bugs in image handling.
........
r65373 | georg.brandl | 2008-08-01 19:28:33 +0000 (Fri, 01 Aug 2008) | 2 lines
Fix oversight.
........
r65374 | benjamin.peterson | 2008-08-01 19:36:32 +0000 (Fri, 01 Aug 2008) | 1 line
fix one broken test
........
r65375 | georg.brandl | 2008-08-01 19:41:11 +0000 (Fri, 01 Aug 2008) | 2 lines
Fix the handling of non-ASCII input in quickstart.
........
r65377 | georg.brandl | 2008-08-01 19:48:24 +0000 (Fri, 01 Aug 2008) | 2 lines
Allow REs in markup checks.
........
r65380 | georg.brandl | 2008-08-01 20:31:18 +0000 (Fri, 01 Aug 2008) | 2 lines
Don't rely on mtimes being different for changed files.
........
r65483 | georg.brandl | 2008-08-04 09:01:40 +0000 (Mon, 04 Aug 2008) | 4 lines
Add an "encoding" option to literalinclude.
Add tests for include directives.
........
r65484 | georg.brandl | 2008-08-04 09:11:17 +0000 (Mon, 04 Aug 2008) | 2 lines
Add changelog entry.
........
r65485 | georg.brandl | 2008-08-04 09:21:58 +0000 (Mon, 04 Aug 2008) | 2 lines
Fix markup.
........
r65494 | georg.brandl | 2008-08-04 16:34:59 +0000 (Mon, 04 Aug 2008) | 2 lines
Correctly use HTML file suffix in templates.
........
2008-08-04 12:01:15 -05:00
|
|
|
|
2008-08-04 16:48:12 -05:00
|
|
|
|
2014-07-12 08:14:14 -05:00
|
|
|
def teardown_module():
|
|
|
|
(test_root / '_build').rmtree(True)
|
2009-02-21 10:17:21 -06:00
|
|
|
|
2009-12-28 10:09:09 -06:00
|
|
|
|
2014-07-12 08:14:14 -05:00
|
|
|
def test_build():
|
2014-07-12 20:44:48 -05:00
|
|
|
for buildername in ('pickle', 'json', 'linkcheck', 'text', 'htmlhelp',
|
|
|
|
'qthelp', 'epub', 'changes', 'singlehtml', 'xml',
|
|
|
|
'pseudoxml'):
|
2014-07-12 08:14:14 -05:00
|
|
|
app = TestApp(buildername=buildername)
|
|
|
|
yield lambda app: app.builder.build_all(), app
|
|
|
|
app.cleanup()
|
2010-01-17 09:48:02 -06:00
|
|
|
|
2012-05-01 01:13:06 -05:00
|
|
|
|
2014-07-12 08:14:14 -05:00
|
|
|
@with_app(buildername='man')
|
|
|
|
def test_man(app):
|
|
|
|
if ManWriter is None:
|
|
|
|
raise SkipTest('man writer is not available')
|
2012-12-04 21:10:15 -06:00
|
|
|
app.builder.build_all()
|
2014-07-12 08:14:14 -05:00
|
|
|
assert (app.outdir / 'SphinxTests.1').exists()
|
2012-12-04 21:10:15 -06:00
|
|
|
|
2012-12-09 19:18:32 -06:00
|
|
|
|
2014-07-12 20:44:48 -05:00
|
|
|
def _test_nonascii_path(app):
|
2012-05-01 01:13:06 -05:00
|
|
|
srcdir = path(app.srcdir)
|
|
|
|
mb_name = u'\u65e5\u672c\u8a9e'
|
2013-09-28 07:51:20 -05:00
|
|
|
try:
|
|
|
|
(srcdir / mb_name).makedirs()
|
|
|
|
except UnicodeEncodeError:
|
|
|
|
from path import FILESYSTEMENCODING
|
|
|
|
raise SkipTest(
|
2013-10-03 01:43:22 -05:00
|
|
|
'nonascii filename not supported on this filesystem encoding: '
|
2013-09-28 07:51:20 -05:00
|
|
|
'%s', FILESYSTEMENCODING)
|
|
|
|
|
2012-05-01 01:13:06 -05:00
|
|
|
(srcdir / mb_name / (mb_name + '.txt')).write_text(dedent("""
|
|
|
|
multi byte file name page
|
|
|
|
==========================
|
|
|
|
"""))
|
|
|
|
|
|
|
|
master_doc = srcdir / 'contents.txt'
|
|
|
|
master_doc.write_bytes((master_doc.text() + dedent("""
|
|
|
|
.. toctree::
|
2013-01-06 23:36:33 -06:00
|
|
|
|
2012-05-01 01:13:06 -05:00
|
|
|
%(mb_name)s/%(mb_name)s
|
2014-07-12 20:44:48 -05:00
|
|
|
""" % {'mb_name': mb_name})
|
2012-05-01 01:13:06 -05:00
|
|
|
).encode('utf-8'))
|
|
|
|
app.builder.build_all()
|
2014-07-12 20:44:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
def test_nonascii_path():
|
|
|
|
(test_root / '_build').rmtree(True) #keep this to build first gettext
|
|
|
|
|
|
|
|
builder_names = ['gettext', 'html', 'dirhtml', 'singlehtml', 'latex',
|
|
|
|
'texinfo', 'pickle', 'json', 'linkcheck', 'text',
|
|
|
|
'htmlhelp', 'qthelp', 'epub', 'changes', 'xml',
|
|
|
|
'pseudoxml']
|
|
|
|
if ManWriter is not None:
|
|
|
|
builder_names.append('man')
|
|
|
|
|
|
|
|
for buildername in builder_names:
|
2014-08-10 08:23:52 -05:00
|
|
|
app = TestApp(buildername=buildername, _copy_to_temp=True)
|
2014-07-12 20:44:48 -05:00
|
|
|
yield _test_nonascii_path, app
|
|
|
|
app.cleanup()
|
2014-08-18 20:44:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
@with_app(buildername='text', srcdir='(empty)')
|
|
|
|
def test_circular_toctree(app):
|
|
|
|
contents = (".. toctree::\n"
|
|
|
|
"\n"
|
|
|
|
" sub\n")
|
|
|
|
(app.srcdir / 'contents.rst').write_text(contents, encoding='utf-8')
|
|
|
|
|
|
|
|
contents = (".. toctree::\n"
|
|
|
|
"\n"
|
|
|
|
" contents\n")
|
|
|
|
(app.srcdir / 'sub.rst').write_text(contents, encoding='utf-8')
|
|
|
|
app.builder.build_all()
|
|
|
|
warnings = "".join(app._warning.content)
|
|
|
|
assert 'circular toctree references detected, ignoring: sub <- contents <- sub' in warnings
|
|
|
|
assert 'circular toctree references detected, ignoring: contents <- sub <- contents' in warnings
|
|
|
|
|
|
|
|
|
|
|
|
@with_app(buildername='text', srcdir='(empty)')
|
|
|
|
def test_numbered_circular_toctree(app):
|
|
|
|
contents = (".. toctree::\n"
|
|
|
|
" :numbered:\n"
|
|
|
|
"\n"
|
|
|
|
" sub\n")
|
|
|
|
(app.srcdir / 'contents.rst').write_text(contents, encoding='utf-8')
|
|
|
|
|
|
|
|
contents = (".. toctree::\n"
|
|
|
|
"\n"
|
|
|
|
" contents\n")
|
|
|
|
(app.srcdir / 'sub.rst').write_text(contents, encoding='utf-8')
|
|
|
|
app.builder.build_all()
|
|
|
|
warnings = "\n".join(app._warning.content)
|
|
|
|
assert 'circular toctree references detected, ignoring: sub <- contents <- sub' in warnings
|
|
|
|
assert 'circular toctree references detected, ignoring: contents <- sub <- contents' in warnings
|