From e4f234d241f25d93ebed364c46066826bfc88cbc Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Wed, 4 May 2022 21:21:26 +0200 Subject: [PATCH] Feat: add e2e test with failed compilation --- test/test_e2e.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/test_e2e.py b/test/test_e2e.py index 2945c63..53c703b 100644 --- a/test/test_e2e.py +++ b/test/test_e2e.py @@ -22,6 +22,22 @@ Subject {{ number }} ) return template +@pytest.fixture +def bad_template_path(tmp_path): + template = tmp_path / "tpl_source.tex" + with open(template, "w") as tpl: + tpl.write( + """ +\\documentclass{article} + +\\begin{document} +First document. + +Subject {{ number }} + """ + ) + return template + @pytest.fixture def jinja2_env(tmp_path): @@ -48,3 +64,22 @@ def test_with_default_planner(template_path, jinja2_env, tmp_path): assert Path("joined_source.pdf").exists() +def test_with_default_planner_bad_template(bad_template_path, jinja2_env, tmp_path): + os.chdir(tmp_path) + + options = { + "template": str(bad_template_path.name), + "quantity_subjects": 3, + "corr": False, + "no_join": False, + "no_pdf": False, + "jinja2": { + "environment": jinja2_env, + }, + } + + for message in main(**options): + pass + + assert not Path("joined_source.pdf").exists() +