mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Cosmetic fixes to make flak8 happy
This commit is contained in:
parent
9b31eda7f3
commit
39bd1e48be
2 changed files with 8 additions and 5 deletions
|
|
@ -529,17 +529,18 @@ def configure_settings(settings):
|
||||||
preserved = {}
|
preserved = {}
|
||||||
logger.debug('Theme provides a config `%s`', theme_config)
|
logger.debug('Theme provides a config `%s`', theme_config)
|
||||||
# preserve variables that are dynamically calculated in read_settings()
|
# preserve variables that are dynamically calculated in read_settings()
|
||||||
for p in ['PATH', 'OUTPUT_PATH', 'THEME', 'CACHE_PATH', 'PLUGIN_PATHS']:
|
for p in ['PATH', 'OUTPUT_PATH', 'THEME', 'CACHE_PATH',
|
||||||
|
'PLUGIN_PATHS']:
|
||||||
if settings.get(p) is not None:
|
if settings.get(p) is not None:
|
||||||
preserved[p] = settings.get(p)
|
preserved[p] = settings.get(p)
|
||||||
settings.pop('THEME') # avoid recursion
|
settings.pop('THEME') # avoid recursion
|
||||||
settings = read_settings(theme_config, settings)
|
settings = read_settings(theme_config, settings)
|
||||||
# restore them back to look like we did not calculate them again
|
# restore them back to look like we did not calculate them again
|
||||||
for p in ['PATH', 'OUTPUT_PATH', 'THEME', 'CACHE_PATH', 'PLUGIN_PATHS']:
|
for p in ['PATH', 'OUTPUT_PATH', 'THEME', 'CACHE_PATH',
|
||||||
|
'PLUGIN_PATHS']:
|
||||||
if preserved.get(p) is not None:
|
if preserved.get(p) is not None:
|
||||||
settings[p] = preserved.pop(p)
|
settings[p] = preserved.pop(p)
|
||||||
|
|
||||||
|
|
||||||
# make paths selected for writing absolute if necessary
|
# make paths selected for writing absolute if necessary
|
||||||
settings['WRITE_SELECTED'] = [
|
settings['WRITE_SELECTED'] = [
|
||||||
os.path.abspath(path) for path in
|
os.path.abspath(path) for path in
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,14 @@ import os
|
||||||
from os.path import abspath, dirname, join
|
from os.path import abspath, dirname, join
|
||||||
from sys import platform
|
from sys import platform
|
||||||
|
|
||||||
|
|
||||||
from pelican.settings import (DEFAULT_CONFIG, DEFAULT_THEME,
|
from pelican.settings import (DEFAULT_CONFIG, DEFAULT_THEME,
|
||||||
_printf_s_to_format_field,
|
_printf_s_to_format_field,
|
||||||
configure_settings, handle_deprecated_settings,
|
configure_settings, handle_deprecated_settings,
|
||||||
read_settings)
|
read_settings)
|
||||||
from pelican.tests.support import unittest
|
from pelican.tests.support import unittest
|
||||||
|
|
||||||
|
|
||||||
class TestSettingsConfiguration(unittest.TestCase):
|
class TestSettingsConfiguration(unittest.TestCase):
|
||||||
"""Provided a file, it should read it, replace the default values,
|
"""Provided a file, it should read it, replace the default values,
|
||||||
append new values to the settings (if any), and apply basic settings
|
append new values to the settings (if any), and apply basic settings
|
||||||
|
|
@ -72,7 +74,7 @@ class TestSettingsConfiguration(unittest.TestCase):
|
||||||
expected = copy.deepcopy(self.settings)
|
expected = copy.deepcopy(self.settings)
|
||||||
expected['THEME'] = os.path.join(self.PATH, 'themes/custom')
|
expected['THEME'] = os.path.join(self.PATH, 'themes/custom')
|
||||||
expected['CUSTOM_THEME_SETTING'] = 'test'
|
expected['CUSTOM_THEME_SETTING'] = 'test'
|
||||||
settings = read_settings(default_conf, { 'THEME': 'themes/custom' } )
|
settings = read_settings(default_conf, {'THEME': 'themes/custom'})
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertDictEqual(settings, expected)
|
self.assertDictEqual(settings, expected)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue