forked from github/pelican
tests.support: Use kwargs overrides in get_settings()
This avoids harcoding test-specific overrides, and makes it easy to
setup a settings dictionary based on DEFAULT_CONFIG for testing.
Because you can trust Pelican to use settings based on DEFAULT_CONFIG,
you are free to go about using:
settings[my_key]
instead of:
settings.get(my_key, some_fallback)
or:
if my_key in settings:
...
if you know that `my_key` is in DEFAULT_CONFIG.
This commit is contained in:
parent
8511915294
commit
c8e7d95b34
4 changed files with 66 additions and 68 deletions
|
|
@ -161,10 +161,14 @@ def locale_available(locale_):
|
|||
return True
|
||||
|
||||
|
||||
def get_settings():
|
||||
def get_settings(**kwargs):
|
||||
"""Provide tweaked setting dictionaries for testing
|
||||
|
||||
Set keyword arguments to override specific settings.
|
||||
"""
|
||||
settings = DEFAULT_CONFIG.copy()
|
||||
settings['DIRECT_TEMPLATES'] = ['archives']
|
||||
settings['filenames'] = {}
|
||||
for key,value in kwargs.items():
|
||||
settings[key] = value
|
||||
return settings
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue