Skip to content

Skipping latex tasks does not work when latexmk is not installed #78

Closed
@timmens

Description

@timmens

Hey!

As the title says, when I try to skip a task marked with pytask.mark.latex, I get an error unless latexmk is installed. I imagine you already know this, but I've included a use case and an MRE below, nevertheless.

Use Case

I run/develop a project on multiple machines and want to skip latex- related tasks on some of them; and I do not want to install latexmk on them.

MRE

Using pytask's conftest.py:

from pytask import cli, ExitCode
import textwrap


def test_pytask(runner, tmp_path, monkeypatch):
    source = """
    from pathlib import Path
    from pytask import mark

    @mark.skip()
    @mark.latex(script=Path("document.tex"), document=Path("document.pdf"))
    def task_compile_latex_document():
        pass
    """
    # Works with latexmk in PATH.
    tmp_path.joinpath("task_module.py").write_text(textwrap.dedent(source))
    result = runner.invoke(cli, [tmp_path.as_posix()])
    assert result.exit_code == ExitCode.OK

    # Fails with latexmk removed from PATH.
    monkeypatch.setenv("PATH", "")
    tmp_path.joinpath("task_module.py").write_text(textwrap.dedent(source))
    result = runner.invoke(cli, [tmp_path.as_posix()])
    assert result.exit_code == ExitCode.FAILED
    
    # Print error message
    print(result.stdout)

Which produces:

Versions

  • pytask: 0.5.1
  • pytask-latex 0.4.2
  • python: 3.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions