mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Fix DELETE_OUTPUT_DIRECTORY crash when no output dir
This commit is contained in:
parent
52ce7983e4
commit
15875b8bd1
2 changed files with 24 additions and 0 deletions
|
|
@ -112,3 +112,16 @@ class TestUtils(unittest.TestCase):
|
|||
self.assertTrue(os.path.isdir(test_directory))
|
||||
self.assertListEqual([], os.listdir(test_directory))
|
||||
shutil.rmtree(test_directory)
|
||||
|
||||
def test_clean_output_dir_not_there(self):
|
||||
test_directory = os.path.join(os.path.dirname(__file__), 'does_not_exist')
|
||||
utils.clean_output_dir(test_directory)
|
||||
self.assertTrue(not os.path.exists(test_directory))
|
||||
|
||||
def test_clean_output_dir_is_file(self):
|
||||
test_directory = os.path.join(os.path.dirname(__file__), 'this_is_a_file')
|
||||
f = open(test_directory, 'w')
|
||||
f.write('')
|
||||
f.close()
|
||||
utils.clean_output_dir(test_directory)
|
||||
self.assertTrue(not os.path.exists(test_directory))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue