enable writing of only selected output paths

- add WRITE_SELECTED setting
- add --write-selected commandline option
This commit is contained in:
Ondrej Grover 2014-04-17 16:28:22 +02:00
commit 6703950abe
7 changed files with 81 additions and 2 deletions

View file

@ -138,3 +138,26 @@ class TestPelican(LoggedTestCase):
for file in ['a_stylesheet', 'a_template']:
self.assertTrue(os.path.exists(os.path.join(theme_output, file)))
def test_write_only_selected(self):
"""Test that only the selected files are written"""
settings = read_settings(path=None, override={
'PATH': INPUT_PATH,
'OUTPUT_PATH': self.temp_path,
'CACHE_DIRECTORY': self.temp_cache,
'WRITE_SELECTED': [
os.path.join(self.temp_path, 'oh-yeah.html'),
os.path.join(self.temp_path, 'categories.html'),
],
'LOCALE': locale.normalize('en_US'),
})
pelican = Pelican(settings=settings)
logger = logging.getLogger()
orig_level = logger.getEffectiveLevel()
logger.setLevel(logging.INFO)
mute(True)(pelican.run)()
logger.setLevel(orig_level)
self.assertLogCountEqual(
count=2,
msg="writing .*",
level=logging.INFO)