mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
Fixes #1984: Hint None being valid for primary_domain.
This commit is contained in:
+2
-2
@@ -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'),
|
||||
|
||||
@@ -20,6 +20,8 @@ from itertools import product
|
||||
|
||||
from six import PY3, text_type, exec_
|
||||
|
||||
NoneType = type(None)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Python 2/3 compatibility
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user