def test_generate_empty_html(self):
""" Ensures the application is still rendered gracefully """
self.app.config['ARA_IGNORE_EMPTY_GENERATION'] = False
dir = self.generate_dir
shell = ara.shell.AraCli()
shell.prepare_to_run_command(ara.cli.generate.GenerateHtml)
cmd = ara.cli.generate.GenerateHtml(shell, None)
parser = cmd.get_parser('test')
args = parser.parse_args([dir])
with pytest.warns(MissingURLGeneratorWarning) as warnings:
cmd.take_action(args)
# pytest 3.0 through 3.1 are backwards incompatible here
if LooseVersion(pytest.__version__) >= LooseVersion('3.1.0'):
cat = [item._category_name for item in warnings]
self.assertTrue(any('MissingURLGeneratorWarning' in c
for c in cat))
else:
self.assertTrue(any(MissingURLGeneratorWarning == w.category
for w in warnings))
paths = [
os.path.join(dir, 'index.html'),
os.path.join(dir, 'static'),
]
for path in paths:
self.assertTrue(os.path.exists(path))
评论列表
文章目录