From 1cad4c9044d47c6653d804d7fb58581d92f96cc8 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Mon, 4 Jan 2021 13:40:21 +0100 Subject: Change organisation --- plugins/render_math/test_render_math.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) mode change 100755 => 100644 plugins/render_math/test_render_math.py (limited to 'plugins/render_math/test_render_math.py') diff --git a/plugins/render_math/test_render_math.py b/plugins/render_math/test_render_math.py old mode 100755 new mode 100644 index b71f4e7..dc1e5fd --- a/plugins/render_math/test_render_math.py +++ b/plugins/render_math/test_render_math.py @@ -10,22 +10,22 @@ from pelican.writers import Writer from .math import pelican_init, process_rst_and_summaries - CUR_DIR = dirname(__file__) class RenderMathTest(unittest.TestCase): def test_ok_on_shared_test_data(self): settings = get_settings(filenames={}) - settings['PATH'] = join(CUR_DIR, '..', 'test_data') + settings["PATH"] = join(CUR_DIR, "..", "test_data") pelican_init(PelicanMock(settings)) with TemporaryDirectory() as tmpdirname: generator = _build_article_generator(settings, tmpdirname) process_rst_and_summaries([generator]) + def test_ok_on_custom_data(self): settings = get_settings(filenames={}) - settings['PATH'] = join(CUR_DIR, 'test_data') - settings['PLUGINS'] = ['pelican-ipynb.markup'] # to also parse .ipynb files + settings["PATH"] = join(CUR_DIR, "test_data") + settings["PLUGINS"] = ["pelican-ipynb.markup"] # to also parse .ipynb files configure_settings(settings) pelican_mock = PelicanMock(settings) pelican_init(pelican_mock) @@ -34,23 +34,29 @@ class RenderMathTest(unittest.TestCase): generator = _build_article_generator(settings, tmpdirname) process_rst_and_summaries([generator]) for article in generator.articles: - if article.source_path.endswith('.rst'): - self.assertIn('mathjaxscript_pelican', article.content) + if article.source_path.endswith(".rst"): + self.assertIn("mathjaxscript_pelican", article.content) generator.generate_output(Writer(tmpdirname, settings=settings)) def _build_article_generator(settings, output_path): context = settings.copy() - context['generated_content'] = dict() - context['static_links'] = set() + context["generated_content"] = dict() + context["static_links"] = set() article_generator = ArticlesGenerator( - context=context, settings=settings, - path=settings['PATH'], theme=settings['THEME'], output_path=output_path) + context=context, + settings=settings, + path=settings["PATH"], + theme=settings["THEME"], + output_path=output_path, + ) article_generator.generate_context() return article_generator + class PelicanMock: - 'A dummy class exposing the only attributes needed' + "A dummy class exposing the only attributes needed" + def __init__(self, settings): self.plugins = [] self.settings = settings -- cgit v1.2.3