|
6 | 6 | import pytest
|
7 | 7 | from pytask import ExitCode
|
8 | 8 | from pytask import Mark
|
| 9 | +from pytask import Skipped |
9 | 10 | from pytask import Task
|
10 | 11 | from pytask import build
|
11 | 12 | from pytask import cli
|
@@ -156,7 +157,6 @@ def task_compile_document():
|
156 | 157 | assert result.exit_code == ExitCode.OK
|
157 | 158 |
|
158 | 159 |
|
159 |
| -@needs_latexmk |
160 | 160 | @skip_on_github_actions_with_win
|
161 | 161 | @pytest.mark.end_to_end
|
162 | 162 | def test_raise_error_if_latexmk_is_not_found(tmp_path, monkeypatch):
|
@@ -190,6 +190,40 @@ def task_compile_document():
|
190 | 190 | assert isinstance(session.execution_reports[0].exc_info[1], RuntimeError)
|
191 | 191 |
|
192 | 192 |
|
| 193 | +@skip_on_github_actions_with_win |
| 194 | +@pytest.mark.end_to_end |
| 195 | +def test_skip_even_if_latexmk_is_not_found(tmp_path, monkeypatch): |
| 196 | + task_source = """ |
| 197 | + from pytask import mark |
| 198 | +
|
| 199 | + @mark.skip(reason="Skip it.") |
| 200 | + @mark.latex(script="document.tex", document="document.pdf") |
| 201 | + def task_compile_document(): |
| 202 | + pass |
| 203 | + """ |
| 204 | + tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(task_source)) |
| 205 | + |
| 206 | + latex_source = r""" |
| 207 | + \documentclass{report} |
| 208 | + \begin{document} |
| 209 | + Ein Fuchs muss tun, was ein Fuchs tun muss. Luxus und Ruhm und rulen bis zum |
| 210 | + Schluss. |
| 211 | + \end{document} |
| 212 | + """ |
| 213 | + tmp_path.joinpath("document.tex").write_text(textwrap.dedent(latex_source)) |
| 214 | + |
| 215 | + # Hide latexmk if available. |
| 216 | + monkeypatch.setattr( |
| 217 | + "pytask_latex.execute.shutil.which", |
| 218 | + lambda x: None, # noqa: ARG005 |
| 219 | + ) |
| 220 | + |
| 221 | + session = build(paths=tmp_path) |
| 222 | + |
| 223 | + assert session.exit_code == ExitCode.OK |
| 224 | + assert isinstance(session.execution_reports[0].exc_info[1], Skipped) |
| 225 | + |
| 226 | + |
193 | 227 | @needs_latexmk
|
194 | 228 | @skip_on_github_actions_with_win
|
195 | 229 | @pytest.mark.end_to_end
|
|
0 commit comments