summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2017-07-31 22:30:37 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2017-07-31 22:30:48 +0900
commitd63a6782287b797fa3924e59f2df113d73e9a909 (patch)
tree89a8adf607af8ca5aa3efca201cf88a31eea085b
parent22e7380a7011a6863512863ecdb7d73ec2dfd26c (diff)
downloadsphinx-git-d63a6782287b797fa3924e59f2df113d73e9a909.tar.gz
Reduce DeprecationWarning
-rw-r--r--sphinx/builders/epub3.py29
-rw-r--r--sphinx/builders/html.py4
-rw-r--r--tests/test_directive_only.py2
-rw-r--r--tests/test_environment_toctree.py17
4 files changed, 25 insertions, 27 deletions
diff --git a/sphinx/builders/epub3.py b/sphinx/builders/epub3.py
index 6256b0f6d..fb2a71b34 100644
--- a/sphinx/builders/epub3.py
+++ b/sphinx/builders/epub3.py
@@ -85,40 +85,37 @@ class Epub3Builder(_epub_base.EpubBuilder):
def validate_config_value(self):
# <package> lang attribute, dc:language
if not self.app.config.epub_language:
- self.app.warn(
- 'conf value "epub_language" (or "language") '
- 'should not be empty for EPUB3')
+ logger.warning('conf value "epub_language" (or "language") '
+ 'should not be empty for EPUB3')
# <package> unique-identifier attribute
if not xmlname_checker().match(self.app.config.epub_uid):
- self.app.warn('conf value "epub_uid" should be XML NAME for EPUB3')
+ logger.warning('conf value "epub_uid" should be XML NAME for EPUB3')
# dc:title
if not self.app.config.epub_title:
- self.app.warn(
- 'conf value "epub_title" (or "html_title") '
- 'should not be empty for EPUB3')
+ logger.warning('conf value "epub_title" (or "html_title") '
+ 'should not be empty for EPUB3')
# dc:creator
if not self.app.config.epub_author:
- self.app.warn('conf value "epub_author" should not be empty for EPUB3')
+ logger.warning('conf value "epub_author" should not be empty for EPUB3')
# dc:contributor
if not self.app.config.epub_contributor:
- self.app.warn('conf value "epub_contributor" should not be empty for EPUB3')
+ logger.warning('conf value "epub_contributor" should not be empty for EPUB3')
# dc:description
if not self.app.config.epub_description:
- self.app.warn('conf value "epub_description" should not be empty for EPUB3')
+ logger.warning('conf value "epub_description" should not be empty for EPUB3')
# dc:publisher
if not self.app.config.epub_publisher:
- self.app.warn('conf value "epub_publisher" should not be empty for EPUB3')
+ logger.warning('conf value "epub_publisher" should not be empty for EPUB3')
# dc:rights
if not self.app.config.epub_copyright:
- self.app.warn(
- 'conf value "epub_copyright" (or "copyright")'
- 'should not be empty for EPUB3')
+ logger.warning('conf value "epub_copyright" (or "copyright")'
+ 'should not be empty for EPUB3')
# dc:identifier
if not self.app.config.epub_identifier:
- self.app.warn('conf value "epub_identifier" should not be empty for EPUB3')
+ logger.warning('conf value "epub_identifier" should not be empty for EPUB3')
# meta ibooks:version
if not self.app.config.version:
- self.app.warn('conf value "version" should not be empty for EPUB3')
+ logger.warning('conf value "version" should not be empty for EPUB3')
def content_metadata(self):
# type: () -> Dict
diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py
index 540125b2a..0265f6a1b 100644
--- a/sphinx/builders/html.py
+++ b/sphinx/builders/html.py
@@ -605,7 +605,7 @@ class StandaloneHTMLBuilder(Builder):
# additional pages from conf.py
for pagename, template in self.config.html_additional_pages.items():
- self.info(' ' + pagename, nonl=1)
+ logger.info(' ' + pagename, nonl=1)
self.handle_page(pagename, {}, template)
# the search page
@@ -1188,7 +1188,7 @@ class SingleFileHTMLBuilder(StandaloneHTMLBuilder):
# additional pages from conf.py
for pagename, template in self.config.html_additional_pages.items():
- self.info(' ' + pagename, nonl=1)
+ logger.info(' ' + pagename, nonl=1)
self.handle_page(pagename, {}, template)
if self.config.html_use_opensearch:
diff --git a/tests/test_directive_only.py b/tests/test_directive_only.py
index 35d15b391..d70585774 100644
--- a/tests/test_directive_only.py
+++ b/tests/test_directive_only.py
@@ -46,7 +46,7 @@ def test_sectioning(app, status, warning):
app.builder.build(['only'])
doctree = app.env.get_doctree('only')
- process_only_nodes(doctree, app.builder.tags)
+ app.env.apply_post_transforms(doctree, 'only')
parts = [getsects(n)
for n in [_n for _n in doctree.children if isinstance(_n, nodes.section)]]
diff --git a/tests/test_environment_toctree.py b/tests/test_environment_toctree.py
index db07aa479..5fef9218a 100644
--- a/tests/test_environment_toctree.py
+++ b/tests/test_environment_toctree.py
@@ -14,6 +14,7 @@ from docutils.nodes import bullet_list, list_item, caption, comment, reference
from sphinx import addnodes
from sphinx.addnodes import compact_paragraph, only
from sphinx.builders.html import StandaloneHTMLBuilder
+from sphinx.environment.adapters.toctree import TocTree
import pytest
from sphinx.testing.util import assert_node
@@ -138,7 +139,7 @@ def test_glob(app):
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
def test_get_toc_for(app):
app.build()
- toctree = app.env.get_toc_for('index', app.builder)
+ toctree = TocTree(app.env).get_toc_for('index', app.builder)
assert_node(toctree,
[bullet_list, ([list_item, (compact_paragraph, # [0][0]
@@ -165,7 +166,7 @@ def test_get_toc_for(app):
def test_get_toc_for_only(app):
app.build()
builder = StandaloneHTMLBuilder(app)
- toctree = app.env.get_toc_for('index', builder)
+ toctree = TocTree(app.env).get_toc_for('index', builder)
assert_node(toctree,
[bullet_list, ([list_item, (compact_paragraph, # [0][0]
@@ -194,7 +195,7 @@ def test_get_toc_for_only(app):
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
def test_get_toc_for_tocdepth(app):
app.build()
- toctree = app.env.get_toc_for('tocdepth', app.builder)
+ toctree = TocTree(app.env).get_toc_for('tocdepth', app.builder)
assert_node(toctree,
[bullet_list, list_item, (compact_paragraph, # [0][0]
@@ -209,7 +210,7 @@ def test_get_toc_for_tocdepth(app):
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
def test_get_toctree_for(app):
app.build()
- toctree = app.env.get_toctree_for('index', app.builder, collapse=False)
+ toctree = TocTree(app.env).get_toctree_for('index', app.builder, collapse=False)
assert_node(toctree,
[compact_paragraph, ([caption, "Table of Contents"],
bullet_list,
@@ -246,7 +247,7 @@ def test_get_toctree_for(app):
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
def test_get_toctree_for_collapse(app):
app.build()
- toctree = app.env.get_toctree_for('index', app.builder, collapse=True)
+ toctree = TocTree(app.env).get_toctree_for('index', app.builder, collapse=True)
assert_node(toctree,
[compact_paragraph, ([caption, "Table of Contents"],
bullet_list,
@@ -274,7 +275,7 @@ def test_get_toctree_for_collapse(app):
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
def test_get_toctree_for_maxdepth(app):
app.build()
- toctree = app.env.get_toctree_for('index', app.builder, collapse=False, maxdepth=3)
+ toctree = TocTree(app.env).get_toctree_for('index', app.builder, collapse=False, maxdepth=3)
assert_node(toctree,
[compact_paragraph, ([caption, "Table of Contents"],
bullet_list,
@@ -316,8 +317,8 @@ def test_get_toctree_for_maxdepth(app):
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
def test_get_toctree_for_includehidden(app):
app.build()
- toctree = app.env.get_toctree_for('index', app.builder, collapse=False,
- includehidden=False)
+ toctree = TocTree(app.env).get_toctree_for('index', app.builder, collapse=False,
+ includehidden=False)
assert_node(toctree,
[compact_paragraph, ([caption, "Table of Contents"],
bullet_list,