Merge pull request #476 from tbunnyman/fixAutorunInfLoop

Fix autorun inf loop
This commit is contained in:
the Bunny Man 2012-08-29 08:58:19 -07:00
commit fb8a069d4a
3 changed files with 33 additions and 6 deletions

View file

@ -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')