summaryrefslogtreecommitdiff
path: root/tests/test_config.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-08-25 12:02:59 +0000
committerGeorg Brandl <georg@python.org>2010-08-25 12:02:59 +0000
commitf1e718bbdcd150cced1ddffe1b166a23b280aebb (patch)
treebc88ca0e1c1e72a978fbb0831f6f47bc5f5c3379 /tests/test_config.py
parent0854f642623a096e39977072923d2ebe8e8a49f3 (diff)
parent1bd4ac3103fd8a4944376a766422ba4a0a7416bd (diff)
downloadsphinx-f1e718bbdcd150cced1ddffe1b166a23b280aebb.tar.gz
merge with 1.0
Diffstat (limited to 'tests/test_config.py')
-rw-r--r--tests/test_config.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index cb4e1105..b5f88a6f 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -9,6 +9,7 @@
:copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
+import sys
from util import *
@@ -84,11 +85,23 @@ def test_extension_values(app):
@with_tempdir
def test_errors_warnings(dir):
# test the error for syntax errors in the config file
- write_file(dir / 'conf.py', 'project = \n')
+ write_file(dir / 'conf.py', u'project = \n', 'ascii')
raises_msg(ConfigError, 'conf.py', Config, dir, 'conf.py', {}, None)
+ # test the automatic conversion of 2.x only code in configs
+ write_file(dir / 'conf.py', u'# -*- coding: utf-8\n\n'
+ u'project = u"Jägermeister"\n', 'utf-8')
+ cfg = Config(dir, 'conf.py', {}, None)
+ cfg.init_values()
+ assert cfg.project == u'Jägermeister'
+
# test the warning for bytestrings with non-ascii content
- write_file(dir / 'conf.py', '# -*- coding: latin-1\nproject = "foo\xe4"\n')
+ # bytestrings with non-ascii content are a syntax error in python3 so we
+ # skip the test there
+ if sys.version_info >= (3, 0):
+ return
+ write_file(dir / 'conf.py', u'# -*- coding: latin-1\nproject = "fooä"\n',
+ 'latin-1')
cfg = Config(dir, 'conf.py', {}, None)
warned = [False]
def warn(msg):