Bopytex/test/worker/test_compile.py
Bertrand Benjamin cd2fdc162e
All checks were successful
continuous-integration/drone/push Build is passing
Fix: run pre-commit hooks
2022-07-28 09:39:51 +02:00

37 lines
703 B
Python

import os
from pathlib import Path
import pytest
from bopytex.worker.compile import latexmk
@pytest.fixture
def tex_path(tmp_path):
source = tmp_path / "source.tex"
with open(source, "w") as src:
src.write(
"""
\\documentclass{article}
\\begin{document}
First document. This is a simple example, with no
extra parameters or packages included.
\\end{document}
"""
)
return source
def test_latexmk(tex_path, tmp_path):
# tmp_path = tex_path.parent
os.chdir(tmp_path)
texfile = str(tex_path.name)
output = "source.pdf"
message = latexmk({}, [texfile], "source.pdf")
assert message.status == 0
assert Path(output).exists