Feat: add e2e test with failed compilation

This commit is contained in:
Bertrand Benjamin 2022-05-04 21:21:26 +02:00
parent 0d614465f0
commit e4f234d241

View File

@ -22,6 +22,22 @@ Subject {{ number }}
) )
return template 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 @pytest.fixture
def jinja2_env(tmp_path): 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() 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()