Fixes #1984: Hint None being valid for primary_domain.

This commit is contained in:
Robert Lehmann
2015-09-11 09:56:09 +02:00
parent 8b00f57f4d
commit ca655f31a8
3 changed files with 13 additions and 5 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ from six import PY3, iteritems, string_types, binary_type, integer_types
from sphinx.errors import ConfigError
from sphinx.locale import l_
from sphinx.util.osutil import make_filename, cd
from sphinx.util.pycompat import execfile_
from sphinx.util.pycompat import execfile_, NoneType
nonascii_re = re.compile(br'[\x80-\xff]')
@@ -74,7 +74,7 @@ class Config(object):
rst_epilog = (None, 'env', [str]),
rst_prolog = (None, 'env', [str]),
trim_doctest_flags = (True, 'env'),
primary_domain = ('py', 'env'),
primary_domain = ('py', 'env', [NoneType]),
needs_sphinx = (None, None, [str]),
needs_extensions = ({}, None),
nitpicky = (False, 'env'),
+2
View File
@@ -20,6 +20,8 @@ from itertools import product
from six import PY3, text_type, exec_
NoneType = type(None)
# ------------------------------------------------------------------------------
# Python 2/3 compatibility
+9 -3
View File
@@ -136,12 +136,18 @@ def test_config_eol(tmpdir):
assert cfg.project == u'spam'
@with_app(confoverrides={'master_doc': 123, 'language': 'foo'})
@with_app(confoverrides={
'master_doc': 123,
'language': 'foo',
'primary_domain': None})
def test_builtin_conf(app, status, warning):
assert_in('master_doc', warning.getvalue(),
warning = warning.getvalue()
assert_in('master_doc', warnings,
'override on builtin "master_doc" should raise a type warning')
assert_not_in('language', warning.getvalue(), 'explicitly permitted '
assert_not_in('language', warnings, 'explicitly permitted '
'override on builtin "language" should NOT raise a type warning')
assert_not_in('primary_domain', warnings, 'override to None on builtin '
'"primary_domain" should NOT raise a type warning')
# See roots/test-config/conf.py.