Re-use some existing test with extras

This commit is contained in:
jfbu 2017-12-20 21:30:05 +01:00
parent 245876c6e7
commit 1ee2c2fb95
5 changed files with 41 additions and 66 deletions

View File

@ -1,12 +0,0 @@
# -*- coding: utf-8 -*-
master_doc = 'index'
latex_toplevel_sectioning = 'part'
latex_documents = [
('indexmanual', 'SphinxManual.tex', 'Test toplevel manual',
'Sphinx', 'manual'),
('indexhowto', 'SphinxHowTo.tex', 'Test toplevel howto',
'Sphinx', 'howto'),
]

View File

@ -1,8 +0,0 @@
===================
test-latex-toplevel
===================
.. toctree::
indexmanual
indexhowto

View File

@ -1,10 +0,0 @@
=========================
test-latex-toplevel-howto
=========================
This is a part
==============
This is a section
-----------------

View File

@ -1,13 +0,0 @@
==========================
test-latex-toplevel-manual
==========================
First part
==========
This is chapter
---------------
This is section
~~~~~~~~~~~~~~~

View File

@ -713,20 +713,16 @@ def test_latex_logo_if_not_found(app, status, warning):
assert isinstance(exc, SphinxError)
@pytest.mark.sphinx('latex', testroot='toctree-maxdepth',
confoverrides={'latex_documents': [
('index', 'SphinxTests.tex', 'Sphinx Tests Documentation',
'Georg Brandl', 'manual'),
]})
@pytest.mark.sphinx('latex', testroot='toctree-maxdepth')
def test_toctree_maxdepth_manual(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'SphinxTests.tex').text(encoding='utf8')
result = (app.outdir / 'Python.tex').text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
assert '\\setcounter{tocdepth}{1}' in result
assert '\\setcounter{secnumdepth}' not in result
assert '\\chapter{Foo}' in result
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
@ -742,7 +738,7 @@ def test_toctree_maxdepth_howto(app, status, warning):
print(warning.getvalue())
assert '\\setcounter{tocdepth}{2}' in result
assert '\\setcounter{secnumdepth}' not in result
assert '\\section{Foo}' in result
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
@ -755,7 +751,7 @@ def test_toctree_not_found(app, status, warning):
print(warning.getvalue())
assert '\\setcounter{tocdepth}' not in result
assert '\\setcounter{secnumdepth}' not in result
assert '\\chapter{Foo A}' in result
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
@ -805,6 +801,26 @@ def test_latex_toplevel_sectioning_is_part(app, status, warning):
print(status.getvalue())
print(warning.getvalue())
assert '\\part{Foo}' in result
assert '\\chapter{Foo A}' in result
assert '\\chapter{Foo B}' in result
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'latex_toplevel_sectioning': 'part',
'latex_documents': [
('index', 'Python.tex', 'Sphinx Tests Documentation',
'Georg Brandl', 'howto')
]})
def test_latex_toplevel_sectioning_is_part_with_howto(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'Python.tex').text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
assert '\\part{Foo}' in result
assert '\\section{Foo A}' in result
assert '\\section{Foo B}' in result
@pytest.mark.sphinx(
@ -819,6 +835,22 @@ def test_latex_toplevel_sectioning_is_chapter(app, status, warning):
assert '\\chapter{Foo}' in result
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'latex_toplevel_sectioning': 'chapter',
'latex_documents': [
('index', 'Python.tex', 'Sphinx Tests Documentation',
'Georg Brandl', 'howto')
]})
def test_latex_toplevel_sectioning_is_chapter_with_howto(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'Python.tex').text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
assert '\\section{Foo}' in result
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'latex_toplevel_sectioning': 'section'})
@ -1039,17 +1071,3 @@ def test_latex_image_in_parsed_literal(app, status, warning):
assert ('{\\sphinxunactivateextrasandspace \\raisebox{-0.5\\height}'
'{\\scalebox{2.000000}{\\sphinxincludegraphics[height=1cm]{{pic}.png}}}'
'}AFTER') in result
@pytest.mark.sphinx('latex', testroot='latex-toplevel')
def test_latex_toplevel_is_part(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'SphinxManual.tex').text(encoding='utf8')
assert ('\\part{First part}') in result
assert ('\\chapter{This is chapter}') in result
assert ('\\section{This is section}') in result
result = (app.outdir / 'SphinxHowTo.tex').text(encoding='utf8')
assert ('\\part{This is a part}') in result
assert ('\\section{This is a section}') in result