mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #476 from tbunnyman/fixAutorunInfLoop
Fix autorun inf loop
This commit is contained in:
commit
fb8a069d4a
3 changed files with 33 additions and 6 deletions
|
|
@ -6,6 +6,7 @@ import time
|
|||
|
||||
from pelican import utils
|
||||
from .support import get_article, unittest
|
||||
from pelican.utils import NoFilesError
|
||||
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
|
|
@ -74,7 +75,8 @@ class TestUtils(unittest.TestCase):
|
|||
self.assertNotIn(fr_article1, index)
|
||||
|
||||
def test_files_changed(self):
|
||||
"Test if file changes are correctly detected"
|
||||
"""Test if file changes are correctly detected
|
||||
Make sure to handle not getting any files correctly"""
|
||||
|
||||
path = os.path.join(os.path.dirname(__file__), 'content')
|
||||
filename = os.path.join(path, 'article_with_metadata.rst')
|
||||
|
|
@ -90,6 +92,18 @@ class TestUtils(unittest.TestCase):
|
|||
self.assertEquals(changed, True)
|
||||
self.assertAlmostEqual(utils.LAST_MTIME, t, delta=1)
|
||||
|
||||
empty_path = os.path.join(os.path.dirname(__file__), 'empty')
|
||||
try:
|
||||
os.mkdir(empty_path)
|
||||
os.mkdir(os.path.join(empty_path, "empty_folder"))
|
||||
shutil.copy(__file__, empty_path)
|
||||
with self.assertRaises(NoFilesError):
|
||||
utils.files_changed(empty_path, 'rst')
|
||||
except OSError:
|
||||
self.fail("OSError Exception in test_files_changed test")
|
||||
finally:
|
||||
shutil.rmtree(empty_path, True)
|
||||
|
||||
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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue