summaryrefslogtreecommitdiff
path: root/tests/test_config.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-01-12 10:47:29 +0000
committerGeorg Brandl <georg@python.org>2010-01-12 10:47:29 +0000
commit8bb4d4320dd7e19ca0c2e6be37ce8b7ee096952e (patch)
treeef02625e7fe0bbaf9914f3a91b97c02172c8bfcb /tests/test_config.py
parenta9235ebc238db493076367d605b2f5c65eba7d3a (diff)
parent43d08313a0ecb0b331179c4875cf83728b4d9665 (diff)
downloadsphinx-git-8bb4d4320dd7e19ca0c2e6be37ce8b7ee096952e.tar.gz
merge with 0.6
Diffstat (limited to 'tests/test_config.py')
-rw-r--r--tests/test_config.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index b1c50f704..5193bebe4 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -12,7 +12,8 @@
from util import *
-from sphinx.application import ExtensionError
+from sphinx.config import Config
+from sphinx.errors import ExtensionError, ConfigError
@with_app(confoverrides={'master_doc': 'master', 'nonexisting_value': 'True',
@@ -77,3 +78,19 @@ def test_extension_values(app):
'html_title', 'x', True)
raises_msg(ExtensionError, 'already present', app.add_config_value,
'value_from_ext', 'x', True)
+
+
+@with_tempdir
+def test_errors_warnings(dir):
+ # test the error for syntax errors in the config file
+ write_file(dir / 'conf.py', 'project = \n')
+ raises_msg(ConfigError, 'conf.py', Config, dir, 'conf.py', {}, None)
+
+ # test the warning for bytestrings with non-ascii content
+ write_file(dir / 'conf.py', '# -*- coding: latin-1\nproject = "foo\xe4"\n')
+ cfg = Config(dir, 'conf.py', {}, None)
+ warned = [False]
+ def warn(msg):
+ warned[0] = True
+ cfg.check_unicode(warn)
+ assert warned[0]