forked from github/pelican
Add tests verifying graceful handling on reST errors.
Currently all fail.
This commit is contained in:
parent
b6b3724ed2
commit
5ff553f6f3
3 changed files with 25 additions and 0 deletions
4
pelican/tests/parse_error/parse_error.rst
Normal file
4
pelican/tests/parse_error/parse_error.rst
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
Page with a parse error
|
||||
#############
|
||||
|
||||
The underline is too short.
|
||||
|
|
@ -225,3 +225,18 @@ class TestPelican(LoggedTestCase):
|
|||
count=1,
|
||||
msg="MD_EXTENSIONS is deprecated use MARKDOWN instead.",
|
||||
level=logging.WARNING)
|
||||
|
||||
def test_parse_errors(self):
|
||||
# Verify that just an error is printed and the application doesn't
|
||||
# abort, exit or something.
|
||||
settings = read_settings(path=None, override={
|
||||
'PATH': os.path.abspath(os.path.join(CURRENT_DIR, 'parse_error')),
|
||||
'OUTPUT_PATH': self.temp_path,
|
||||
'CACHE_PATH': self.temp_cache,
|
||||
})
|
||||
pelican = Pelican(settings=settings)
|
||||
mute(True)(pelican.run)()
|
||||
self.assertLogCountEqual(
|
||||
count=1,
|
||||
msg="Could not process .*parse_error.rst",
|
||||
level=logging.ERROR)
|
||||
|
|
|
|||
|
|
@ -410,6 +410,12 @@ class RstReaderTest(ReaderTest):
|
|||
self.assertEqual(tuple_date.metadata['date'],
|
||||
string_date.metadata['date'])
|
||||
|
||||
def test_parse_error(self):
|
||||
# Verify that it raises an Exception, not nothing and not SystemExit or
|
||||
# some such
|
||||
with six.assertRaisesRegex(self, Exception, "underline too short"):
|
||||
self.read_file(path='../parse_error/parse_error.rst')
|
||||
|
||||
|
||||
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
|
||||
class MdReaderTest(ReaderTest):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue