mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
enable writing of only selected output paths
- add WRITE_SELECTED setting - add --write-selected commandline option
This commit is contained in:
parent
34ef5ab098
commit
6703950abe
7 changed files with 81 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue