mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Change behavior of DELETE_OUTPUT_DIRECTORY to purge contents of the directory, not the directory itself.
Added Debug level logging for each deletion Added error level logging when a delete has an exception Built a test case for clean_output_directory in tests.utils.py Updated `settings` in documentation to reflect new behavior Removed the tip from the bottom of getting started since this setting should no longer break web servers pointing to the output directory.
This commit is contained in:
parent
76f86fb3ca
commit
d589450200
4 changed files with 29 additions and 8 deletions
|
|
@ -1,4 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import shutil
|
||||
import os
|
||||
import datetime
|
||||
import time
|
||||
|
|
@ -86,3 +87,13 @@ class TestUtils(unittest.TestCase):
|
|||
changed = utils.files_changed(path, 'rst')
|
||||
self.assertEquals(changed, True)
|
||||
self.assertAlmostEqual(utils.LAST_MTIME, t, delta=1)
|
||||
|
||||
def test_clean_output_dir(self):
|
||||
test_directory = os.path.join(os.path.dirname(__file__), 'clean_output')
|
||||
content = os.path.join(os.path.dirname(__file__), 'content')
|
||||
shutil.copytree(content, test_directory)
|
||||
utils.clean_output_dir(test_directory)
|
||||
self.assertTrue(os.path.isdir(test_directory))
|
||||
self.assertListEqual([], os.listdir(test_directory))
|
||||
shutil.rmtree(test_directory)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue