summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfbu <jfbu@free.fr>2017-12-20 21:30:05 +0100
committerjfbu <jfbu@free.fr>2017-12-20 21:30:05 +0100
commit1ee2c2fb9543d91f13251a3b818feee121d8a2c9 (patch)
treecaa96801c2f316d1df3636dd99eb811e07ba4793
parent245876c6e7917f315857ee59e4c456959f4e6e5c (diff)
downloadsphinx-git-1ee2c2fb9543d91f13251a3b818feee121d8a2c9.tar.gz
Re-use some existing test with extras
-rw-r--r--tests/roots/test-latex-toplevel/conf.py12
-rw-r--r--tests/roots/test-latex-toplevel/index.rst8
-rw-r--r--tests/roots/test-latex-toplevel/indexhowto.rst10
-rw-r--r--tests/roots/test-latex-toplevel/indexmanual.rst13
-rw-r--r--tests/test_build_latex.py64
5 files changed, 41 insertions, 66 deletions
diff --git a/tests/roots/test-latex-toplevel/conf.py b/tests/roots/test-latex-toplevel/conf.py
deleted file mode 100644
index 88efc87ed..000000000
--- a/tests/roots/test-latex-toplevel/conf.py
+++ /dev/null
@@ -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'),
-]
diff --git a/tests/roots/test-latex-toplevel/index.rst b/tests/roots/test-latex-toplevel/index.rst
deleted file mode 100644
index 833bc67bb..000000000
--- a/tests/roots/test-latex-toplevel/index.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-===================
-test-latex-toplevel
-===================
-
-.. toctree::
-
- indexmanual
- indexhowto
diff --git a/tests/roots/test-latex-toplevel/indexhowto.rst b/tests/roots/test-latex-toplevel/indexhowto.rst
deleted file mode 100644
index 7c0c92d1a..000000000
--- a/tests/roots/test-latex-toplevel/indexhowto.rst
+++ /dev/null
@@ -1,10 +0,0 @@
-=========================
-test-latex-toplevel-howto
-=========================
-
-This is a part
-==============
-
-This is a section
------------------
-
diff --git a/tests/roots/test-latex-toplevel/indexmanual.rst b/tests/roots/test-latex-toplevel/indexmanual.rst
deleted file mode 100644
index 2181b1426..000000000
--- a/tests/roots/test-latex-toplevel/indexmanual.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-==========================
-test-latex-toplevel-manual
-==========================
-
-First part
-==========
-
-This is chapter
----------------
-
-This is section
-~~~~~~~~~~~~~~~
-
diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py
index edaf107c4..faa2f46a7 100644
--- a/tests/test_build_latex.py
+++ b/tests/test_build_latex.py
@@ -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(
@@ -821,6 +837,22 @@ def test_latex_toplevel_sectioning_is_chapter(app, status, warning):
@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'})
def test_latex_toplevel_sectioning_is_section(app, status, warning):
app.builder.build_all()
@@ -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