Merge pull request #8484 from tk0miya/8326_root_doc

Close #8326: Rename master_doc to root_doc
This commit is contained in:
Takeshi KOMIYA
2021-02-28 17:49:32 +09:00
committed by GitHub
43 changed files with 145 additions and 104 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
extensions = ['sphinx.ext.doctest']
project = 'test project for the doctest :skipif: directive'
master_doc = 'skipif'
root_doc = 'skipif'
source_suffix = '.txt'
exclude_patterns = ['_build']
+1 -1
View File
@@ -1,6 +1,6 @@
extensions = ['sphinx.ext.doctest']
project = 'test project for doctest'
master_doc = 'doctest'
root_doc = 'doctest'
source_suffix = '.txt'
exclude_patterns = ['_build']
+1 -1
View File
@@ -1,2 +1,2 @@
master_doc = 'equations'
root_doc = 'equations'
extensions = ['sphinx.ext.imgmath']
@@ -1,5 +1,3 @@
master_doc = 'index'
exclude_patterns = ['_build']
latex_elements = {
+1 -1
View File
@@ -1,4 +1,4 @@
master_doc = 'links'
root_doc = 'links'
source_suffix = '.txt'
exclude_patterns = ['_build']
linkcheck_anchors = True
+6 -6
View File
@@ -48,12 +48,12 @@ def nonascii_srcdir(request, rootdir, sphinx_test_tempdir):
=======================
"""))
master_doc = srcdir / 'index.txt'
master_doc.write_text(master_doc.read_text() + dedent("""
.. toctree::
root_doc = srcdir / 'index.txt'
root_doc.write_text(root_doc.read_text() + dedent("""
.. toctree::
%(test_name)s/%(test_name)s
""" % {'test_name': test_name}))
%(test_name)s/%(test_name)s
""" % {'test_name': test_name}))
return srcdir
@@ -71,7 +71,7 @@ def test_build_all(requests_head, make_app, nonascii_srcdir, buildername):
app.build()
def test_master_doc_not_found(tempdir, make_app):
def test_root_doc_not_found(tempdir, make_app):
(tempdir / 'conf.py').write_text('')
assert tempdir.listdir() == ['conf.py']
+4 -4
View File
@@ -1037,7 +1037,7 @@ def test_toctree_maxdepth_howto(app, status, warning):
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'master_doc': 'foo'})
confoverrides={'root_doc': 'foo'})
def test_toctree_not_found(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'python.tex').read_text()
@@ -1051,7 +1051,7 @@ def test_toctree_not_found(app, status, warning):
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'master_doc': 'bar'})
confoverrides={'root_doc': 'bar'})
def test_toctree_without_maxdepth(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'python.tex').read_text()
@@ -1064,7 +1064,7 @@ def test_toctree_without_maxdepth(app, status, warning):
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'master_doc': 'qux'})
confoverrides={'root_doc': 'qux'})
def test_toctree_with_deeper_maxdepth(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'python.tex').read_text()
@@ -1532,7 +1532,7 @@ def test_latex_figure_in_admonition(app, status, warning):
def test_default_latex_documents():
from sphinx.util import texescape
texescape.init()
config = Config({'master_doc': 'index',
config = Config({'root_doc': 'index',
'project': 'STASI™ Documentation',
'author': "Wolfgang Schäuble & G'Beckstein."})
config.init_values()
+7 -7
View File
@@ -20,7 +20,7 @@ from sphinx.testing.path import path
@pytest.mark.sphinx(testroot='config', confoverrides={
'master_doc': 'master',
'root_doc': 'root',
'nonexisting_value': 'True',
'latex_elements.maketitle': 'blah blah blah',
'modindex_common_prefix': 'path1,path2'})
@@ -33,7 +33,7 @@ def test_core_config(app, status, warning):
assert cfg.templates_path == ['_templates']
# overrides
assert cfg.master_doc == 'master'
assert cfg.root_doc == 'root'
assert cfg.latex_elements['maketitle'] == 'blah blah blah'
assert cfg.modindex_common_prefix == ['path1', 'path2']
@@ -78,11 +78,11 @@ def test_extension_values():
config = Config()
# check standard settings
assert config.master_doc == 'index'
assert config.root_doc == 'index'
# can't override it by add_config_value()
with pytest.raises(ExtensionError) as excinfo:
config.add('master_doc', 'index', 'env', None)
config.add('root_doc', 'index', 'env', None)
assert 'already present' in str(excinfo.value)
# add a new config value
@@ -201,13 +201,13 @@ def test_config_eol(logger, tempdir):
assert logger.called is False
@pytest.mark.sphinx(confoverrides={'master_doc': 123,
@pytest.mark.sphinx(confoverrides={'root_doc': 123,
'language': 'foo',
'primary_domain': None})
def test_builtin_conf(app, status, warning):
warnings = warning.getvalue()
assert 'master_doc' in warnings, (
'override on builtin "master_doc" should raise a type warning')
assert 'root_doc' in warnings, (
'override on builtin "root_doc" should raise a type warning')
assert 'language' not in warnings, (
'explicitly permitted override on builtin "language" should NOT raise '
'a type warning')
+2 -2
View File
@@ -35,14 +35,14 @@ def test_config_status(make_app, app_params):
assert "0 added, 0 changed, 0 removed" in app2._status.getvalue()
# incremental build (config entry changed)
app3 = make_app(*args, confoverrides={'master_doc': 'indexx'}, **kwargs)
app3 = make_app(*args, confoverrides={'root_doc': 'indexx'}, **kwargs)
fname = os.path.join(app3.srcdir, 'index.rst')
assert os.path.isfile(fname)
shutil.move(fname, fname[:-4] + 'x.rst')
assert app3.env.config_status == CONFIG_CHANGED
app3.build()
shutil.move(fname[:-4] + 'x.rst', fname)
assert "[config changed ('master_doc')] 1 added" in app3._status.getvalue()
assert "[config changed ('root_doc')] 1 added" in app3._status.getvalue()
# incremental build (extension changed)
app4 = make_app(*args, confoverrides={'extensions': ['sphinx.ext.autodoc']}, **kwargs)
+1 -1
View File
@@ -163,7 +163,7 @@ def test_quickstart_all_answers(tempdir):
]
assert ns['templates_path'] == ['.templates']
assert ns['source_suffix'] == '.txt'
assert ns['master_doc'] == 'contents'
assert ns['root_doc'] == 'contents'
assert ns['project'] == 'STASI™'
assert ns['copyright'] == '%s, Wolfgang Schäuble & G\'Beckstein' % \
time.strftime('%Y')
+5 -5
View File
@@ -93,12 +93,12 @@ def nonascii_srcdir(request, setup_command):
==========================
"""))
master_doc = srcdir / 'index.txt'
master_doc.write_bytes((master_doc.read_text() + dedent("""
.. toctree::
root_doc = srcdir / 'index.txt'
root_doc.write_bytes((root_doc.read_text() + dedent("""
.. toctree::
%(mb_name)s/%(mb_name)s
""" % locals())).encode())
%(mb_name)s/%(mb_name)s
""" % locals())).encode())
@pytest.mark.usefixtures('nonascii_srcdir')