summaryrefslogtreecommitdiff
path: root/tests/test_application.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-01-08 20:19:36 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-01-08 20:19:36 +0900
commit326d7e64cedb5280a9cf51a90c00266e1dab9e7b (patch)
tree0ce4e7845e09aa822da027fbe6401174458c47d9 /tests/test_application.py
parent7a194f52960fe5ace04ef7daa72563e6d3bf094f (diff)
parent3965b1f023bbac932d0dfbf414386f0667ec002a (diff)
downloadsphinx-git-326d7e64cedb5280a9cf51a90c00266e1dab9e7b.tar.gz
Merge branch 'master' into dont_emit_system_message_on_autodoc_warning
Diffstat (limited to 'tests/test_application.py')
-rw-r--r--tests/test_application.py38
1 files changed, 37 insertions, 1 deletions
diff --git a/tests/test_application.py b/tests/test_application.py
index 785a78878..12b6bbe60 100644
--- a/tests/test_application.py
+++ b/tests/test_application.py
@@ -5,13 +5,14 @@
Test the Sphinx class.
- :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
+ :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from docutils import nodes
from sphinx.application import ExtensionError
from sphinx.domains import Domain
+from sphinx.util import logging
from sphinx.testing.util import strip_escseq
import pytest
@@ -86,3 +87,38 @@ def test_add_source_parser(app, status, warning):
assert set(app.registry.get_source_parsers().keys()) == set(['*', '.md', '.test'])
assert app.registry.get_source_parsers()['.md'].__name__ == 'DummyMarkdownParser'
assert app.registry.get_source_parsers()['.test'].__name__ == 'TestSourceParser'
+
+
+@pytest.mark.sphinx(testroot='extensions')
+def test_add_is_parallel_allowed(app, status, warning):
+ logging.setup(app, status, warning)
+
+ assert app.is_parallel_allowed('read') is True
+ assert app.is_parallel_allowed('write') is True
+ assert warning.getvalue() == ''
+
+ app.setup_extension('read_parallel')
+ assert app.is_parallel_allowed('read') is True
+ assert app.is_parallel_allowed('write') is True
+ assert warning.getvalue() == ''
+ app.extensions.pop('read_parallel')
+
+ app.setup_extension('write_parallel')
+ assert app.is_parallel_allowed('read') is False
+ assert app.is_parallel_allowed('write') is True
+ assert 'the write_parallel extension does not declare' in warning.getvalue()
+ app.extensions.pop('write_parallel')
+ warning.truncate(0) # reset warnings
+
+ app.setup_extension('read_serial')
+ assert app.is_parallel_allowed('read') is False
+ assert app.is_parallel_allowed('write') is True
+ assert warning.getvalue() == ''
+ app.extensions.pop('read_serial')
+
+ app.setup_extension('write_serial')
+ assert app.is_parallel_allowed('read') is False
+ assert app.is_parallel_allowed('write') is False
+ assert 'the write_serial extension does not declare' in warning.getvalue()
+ app.extensions.pop('write_serial')
+ warning.truncate(0) # reset warnings