MCPcopy
hub / github.com/mkdocs/mkdocs / test_populate_page_read_plugin_error

Method test_populate_page_read_plugin_error

mkdocs/tests/build_tests.py:371–386  ·  view source on GitHub ↗
(self, docs_dir)

Source from the content-addressed store, hash-verified

369
370 @tempdir(files={'index.md': 'page content'})
371 def test_populate_page_read_plugin_error(self, docs_dir):
372 def on_page_markdown(*args, **kwargs):
373 raise PluginError('Error message.')
374
375 cfg = load_config(docs_dir=docs_dir)
376 cfg.plugins.events['page_markdown'].append(on_page_markdown)
377
378 file = File('index.md', cfg.docs_dir, cfg.site_dir, cfg.use_directory_urls)
379 page = Page('Foo', file, cfg)
380 with self.assertLogs('mkdocs') as cm:
381 with self.assertRaises(PluginError):
382 build._populate_page(page, cfg, Files([file]))
383 self.assertEqual(
384 '\n'.join(cm.output),
385 "ERROR:mkdocs.commands.build:Error reading page 'index.md':",
386 )
387
388 # Test build._build_page
389

Callers

nothing calls this directly

Calls 5

load_configFunction · 0.90
FileClass · 0.90
PageClass · 0.90
FilesClass · 0.90
appendMethod · 0.80

Tested by

no test coverage detected