diff --git a/.github/ISSUE_TEMPLATE/enhancement.md b/.github/ISSUE_TEMPLATE/enhancement.md index 6409c05..fae01a2 100644 --- a/.github/ISSUE_TEMPLATE/enhancement.md +++ b/.github/ISSUE_TEMPLATE/enhancement.md @@ -8,7 +8,7 @@ ______________________________________________________________________ #### Is your feature request related to a problem? Provide a description of what the problem is, e.g. "I wish I could use pytask-latex to -do \[...\]". +do [...]". #### Describe the solution you'd like diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e423e8e..c78a042 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-added-large-files args: ['--maxkb=100'] @@ -26,16 +26,16 @@ repos: - id: python-use-type-annotations - id: text-unicode-replacement-char - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.1 + rev: v0.11.11 hooks: - id: ruff - id: ruff-format - repo: https://github.com/dosisod/refurb - rev: v2.0.0 + rev: v2.1.0 hooks: - id: refurb - repo: https://github.com/executablebooks/mdformat - rev: 0.7.17 + rev: 0.7.22 hooks: - id: mdformat additional_dependencies: [ @@ -44,7 +44,7 @@ repos: ] args: [--wrap, "88"] - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.4.1 hooks: - id: codespell args: [-L als, -L falsy] diff --git a/src/pytask_latex/collect.py b/src/pytask_latex/collect.py index 5eaf57f..95d76ec 100644 --- a/src/pytask_latex/collect.py +++ b/src/pytask_latex/collect.py @@ -219,10 +219,10 @@ def pytask_collect_task( def pytask_collect_modify_tasks(session: Session, tasks: list[PTask]) -> None: """Add dependencies from from LaTeX documents to tasks.""" if session.config["infer_latex_dependencies"]: - all_products = { + all_products = { # type: ignore[var-annotated] product.path for task in tasks - for product in tree_leaves(task.produces) + for product in tree_leaves(task.produces) # type: ignore[arg-type] if isinstance(product, PPathNode) } latex_tasks = [task for task in tasks if has_mark(task, "latex")] @@ -255,7 +255,7 @@ def _add_latex_dependencies_retroactively( # Scan the LaTeX document for included files. try: scanned_deps = set( - lds.scan(task.depends_on["_path_to_tex"].path) # type: ignore[attr-defined] + lds.scan(task.depends_on["_path_to_tex"].path) # type: ignore[arg-type] ) except Exception: # noqa: BLE001 warnings.warn( @@ -265,8 +265,10 @@ def _add_latex_dependencies_retroactively( # Remove duplicated dependencies which have already been added by the user and those # which do not exist. - task_deps = { - i.path for i in tree_leaves(task.depends_on) if isinstance(i, PPathNode) + task_deps = { # type: ignore[var-annotated] + i.path + for i in tree_leaves(task.depends_on) # type: ignore[arg-type] + if isinstance(i, PPathNode) } additional_deps = scanned_deps - task_deps new_deps = [i for i in additional_deps if i in all_products or i.exists()] @@ -287,9 +289,9 @@ def _add_latex_dependencies_retroactively( task_name=task.name, ), ), - new_deps, + new_deps, # type: ignore[arg-type] ) - task.depends_on["_scanned_dependencies"] = collected_dependencies + task.depends_on["_scanned_dependencies"] = collected_dependencies # type: ignore[assignment] # Mark the task as being delayed to avoid conflicts with unmatched dependencies. task.markers.append(Mark("try_last", (), {})) diff --git a/tests/conftest.py b/tests/conftest.py index 195e3c0..c7c1474 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -85,6 +85,6 @@ def invoke(self, *args, **kwargs): return super().invoke(*args, **kwargs) -@pytest.fixture() +@pytest.fixture def runner(): return CustomCliRunner() diff --git a/tests/test_collect.py b/tests/test_collect.py index 536f2ba..58fca5d 100644 --- a/tests/test_collect.py +++ b/tests/test_collect.py @@ -3,10 +3,11 @@ from contextlib import ExitStack as does_not_raise # noqa: N813 import pytest + from pytask_latex.collect import latex -@pytest.mark.unit() +@pytest.mark.unit @pytest.mark.parametrize( ("kwargs", "expectation", "expected"), [ diff --git a/tests/test_config.py b/tests/test_config.py index 423359c..f500c04 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -4,7 +4,7 @@ from pytask import build -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_marker_is_configured(tmp_path): session = build(paths=tmp_path) assert "latex" in session.config["markers"] diff --git a/tests/test_execute.py b/tests/test_execute.py index 8244cef..fe7a16e 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -9,14 +9,14 @@ from pytask import Task from pytask import build from pytask import cli -from pytask_latex.execute import pytask_execute_task_setup +from pytask_latex.execute import pytask_execute_task_setup from tests.conftest import TEST_RESOURCES from tests.conftest import needs_latexmk from tests.conftest import skip_on_github_actions_with_win -@pytest.mark.unit() +@pytest.mark.unit def test_pytask_execute_task_setup(monkeypatch): """Make sure that the task setup raises errors.""" # Act like latexmk is installed since we do not test this. @@ -33,7 +33,7 @@ def test_pytask_execute_task_setup(monkeypatch): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_compile_latex_document(runner, tmp_path): """Test simple compilation.""" task_source = """ @@ -59,7 +59,7 @@ def task_compile_document(): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_compile_latex_document_w_relative(runner, tmp_path): """Test simple compilation.""" task_source = f""" @@ -91,7 +91,7 @@ def task_compile_document(): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_compile_latex_document_to_different_name(runner, tmp_path): """Compile a LaTeX document where source and output name differ.""" task_source = """ @@ -118,7 +118,7 @@ def task_compile_document(): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_compile_w_bibliography(runner, tmp_path): """Compile a LaTeX document with bibliography.""" task_source = """ @@ -158,7 +158,7 @@ def task_compile_document(): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_raise_error_if_latexmk_is_not_found(tmp_path, monkeypatch): task_source = """ from pytask import mark @@ -192,7 +192,7 @@ def task_compile_document(): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_compile_latex_document_w_xelatex(runner, tmp_path): task_source = """ from pytask import mark @@ -227,7 +227,7 @@ def task_compile_document(): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_compile_latex_document_w_two_dependencies(runner, tmp_path): task_source = """ from pytask import mark @@ -255,7 +255,7 @@ def task_compile_document(path: Path = Path("in.txt")): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_fail_because_script_is_not_latex(tmp_path): task_source = """ from pytask import mark @@ -283,7 +283,7 @@ def task_compile_document(path: Path = Path("in.txt")): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_compile_document_to_out_if_document_has_relative_resources(tmp_path): """Test that motivates the ``"--cd"`` flag. @@ -326,7 +326,7 @@ def task_compile_document(path: Path = Path("resources/content.tex")): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_compile_document_w_wrong_flag(tmp_path): """Test that wrong flags raise errors.""" tmp_path.joinpath("sub").mkdir(parents=True) @@ -361,7 +361,7 @@ def task_compile_document(): @needs_latexmk -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_compile_document_w_image(runner, tmp_path): task_source = f""" from pytask import Product @@ -397,7 +397,7 @@ def task_compile_document(): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_compile_latex_document_w_multiple_marks(runner, tmp_path): """Test simple compilation.""" task_source = """ @@ -425,7 +425,7 @@ def task_compile_document(): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_compile_latex_document_with_wrong_extension(runner, tmp_path): """Test simple compilation.""" task_source = """ @@ -452,7 +452,7 @@ def task_compile_document(): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_compile_w_bibliography_and_keep_bbl(runner, tmp_path): """Compile a LaTeX document with bibliography.""" task_source = """ @@ -496,7 +496,7 @@ def task_compile_document( @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end @pytest.mark.parametrize( ("step", "message"), [ @@ -536,7 +536,7 @@ def task_compile_document(): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_compile_latex_document_with_task_decorator(runner, tmp_path): """Test simple compilation.""" task_source = """ @@ -563,7 +563,7 @@ def compile_document(): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_use_task_without_path(tmp_path): task_source = """ import pytask @@ -591,7 +591,7 @@ def test_use_task_without_path(tmp_path): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_collect_latex_document_with_product_from_another_task(runner, tmp_path): """Test simple compilation.""" task_source = """ diff --git a/tests/test_latex_dependency_scanner.py b/tests/test_latex_dependency_scanner.py index 84dd217..493aa89 100644 --- a/tests/test_latex_dependency_scanner.py +++ b/tests/test_latex_dependency_scanner.py @@ -12,7 +12,7 @@ @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end @pytest.mark.parametrize("infer_dependencies", ["true", "false"]) def test_infer_dependencies_from_task(tmp_path, infer_dependencies): task_source = """ diff --git a/tests/test_parallel.py b/tests/test_parallel.py index c37735f..ec94c6b 100644 --- a/tests/test_parallel.py +++ b/tests/test_parallel.py @@ -32,7 +32,7 @@ @xfail_on_remote @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_parallel_parametrization_over_source_files_w_loop(runner, tmp_path): source = """ from pytask import mark, task @@ -68,7 +68,7 @@ def task_compile_latex_document(): @xfail_on_remote @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_parallel_parametrization_over_source_file_w_loop(runner, tmp_path): source = """ from pytask import mark, task diff --git a/tests/test_parametrize.py b/tests/test_parametrize.py index 09a611b..4965c1c 100644 --- a/tests/test_parametrize.py +++ b/tests/test_parametrize.py @@ -12,7 +12,7 @@ @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_parametrized_compilation_of_latex_documents_w_loop(tmp_path): source = """ from pytask import mark, task @@ -48,7 +48,7 @@ def task_compile_latex_document(): @needs_latexmk @skip_on_github_actions_with_win -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_parametrizing_latex_options_w_loop(tmp_path): source = """ from pytask import mark, task