2016-01-08 01:00:26 -06:00
|
|
|
"""
|
|
|
|
test_build_manpage
|
|
|
|
~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Test the build process with manpage builder with the test root.
|
|
|
|
|
2020-12-31 11:00:29 -06:00
|
|
|
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
|
2016-01-08 01:00:26 -06:00
|
|
|
:license: BSD, see LICENSE for details.
|
|
|
|
"""
|
|
|
|
|
2017-01-05 10:14:47 -06:00
|
|
|
import pytest
|
2016-01-08 01:00:26 -06:00
|
|
|
|
2018-11-23 10:08:50 -06:00
|
|
|
from sphinx.builders.manpage import default_man_pages
|
|
|
|
from sphinx.config import Config
|
|
|
|
|
2016-01-08 01:00:26 -06:00
|
|
|
|
2017-01-05 10:14:47 -06:00
|
|
|
@pytest.mark.sphinx('man')
|
2016-01-08 01:00:26 -06:00
|
|
|
def test_all(app, status, warning):
|
|
|
|
app.builder.build_all()
|
2020-10-04 08:45:26 -05:00
|
|
|
assert (app.outdir / '1' / 'sphinxtests.1').exists()
|
2016-01-08 01:00:26 -06:00
|
|
|
|
2020-10-04 08:45:26 -05:00
|
|
|
content = (app.outdir / '1' / 'sphinxtests.1').read_text()
|
2016-01-08 01:00:26 -06:00
|
|
|
assert r'\fBprint \fP\fIi\fP\fB\en\fP' in content
|
2016-01-08 07:17:45 -06:00
|
|
|
assert r'\fBmanpage\en\fP' in content
|
2016-03-06 02:49:49 -06:00
|
|
|
|
|
|
|
# term of definition list including nodes.strong
|
|
|
|
assert '\n.B term1\n' in content
|
|
|
|
assert '\nterm2 (\\fBstronged partially\\fP)\n' in content
|
2018-11-23 10:08:50 -06:00
|
|
|
|
2018-12-08 09:35:46 -06:00
|
|
|
assert 'Footnotes' not in content
|
|
|
|
|
2018-11-23 10:08:50 -06:00
|
|
|
|
2020-10-03 08:26:32 -05:00
|
|
|
@pytest.mark.sphinx('man', testroot='basic',
|
2020-10-04 08:45:26 -05:00
|
|
|
confoverrides={'man_make_section_directory': False})
|
2020-10-03 08:26:32 -05:00
|
|
|
def test_man_make_section_directory(app, status, warning):
|
|
|
|
app.build()
|
2020-10-04 08:45:26 -05:00
|
|
|
assert (app.outdir / 'python.1').exists()
|
2020-10-03 08:26:32 -05:00
|
|
|
|
|
|
|
|
2019-03-09 11:03:11 -06:00
|
|
|
@pytest.mark.sphinx('man', testroot='directive-code')
|
|
|
|
def test_captioned_code_block(app, status, warning):
|
|
|
|
app.builder.build_all()
|
2020-10-04 08:45:26 -05:00
|
|
|
content = (app.outdir / '1' / 'python.1').read_text()
|
2019-03-09 11:03:11 -06:00
|
|
|
|
|
|
|
assert ('.sp\n'
|
|
|
|
'caption \\fItest\\fP rb\n'
|
|
|
|
'.INDENT 0.0\n'
|
|
|
|
'.INDENT 3.5\n'
|
|
|
|
'.sp\n'
|
|
|
|
'.nf\n'
|
|
|
|
'.ft C\n'
|
|
|
|
'def ruby?\n'
|
|
|
|
' false\n'
|
|
|
|
'end\n'
|
|
|
|
'.ft P\n'
|
|
|
|
'.fi\n'
|
|
|
|
'.UNINDENT\n'
|
|
|
|
'.UNINDENT\n' in content)
|
2019-03-10 01:52:51 -06:00
|
|
|
|
|
|
|
|
2018-11-23 10:08:50 -06:00
|
|
|
def test_default_man_pages():
|
2019-01-02 07:20:22 -06:00
|
|
|
config = Config({'project': 'STASI™ Documentation',
|
2018-12-15 08:02:28 -06:00
|
|
|
'author': "Wolfgang Schäuble & G'Beckstein",
|
2018-11-23 10:08:50 -06:00
|
|
|
'release': '1.0'})
|
|
|
|
config.init_values()
|
2018-12-15 08:02:28 -06:00
|
|
|
expected = [('index', 'stasi', 'STASI™ Documentation 1.0',
|
|
|
|
["Wolfgang Schäuble & G'Beckstein"], 1)]
|
2018-11-23 10:08:50 -06:00
|
|
|
assert default_man_pages(config) == expected
|
2019-05-06 07:27:43 -05:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.sphinx('man', testroot='markup-rubric')
|
|
|
|
def test_rubric(app, status, warning):
|
|
|
|
app.build()
|
2020-10-04 08:45:26 -05:00
|
|
|
content = (app.outdir / '1' / 'python.1').read_text()
|
2019-05-06 07:27:43 -05:00
|
|
|
assert 'This is a rubric\n' in content
|