diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4c58ef5..0d492b4 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=25'] @@ -25,12 +25,12 @@ 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.12 hooks: - id: ruff - id: ruff-format - repo: https://github.com/executablebooks/mdformat - rev: 0.7.17 + rev: 0.7.22 hooks: - id: mdformat additional_dependencies: [ @@ -40,7 +40,7 @@ repos: args: [--wrap, "88"] files: (README\.md) - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.4.1 hooks: - id: codespell - repo: meta diff --git a/src/latex_dependency_scanner/scanner.py b/src/latex_dependency_scanner/scanner.py index fe6aa29..2ea75e2 100644 --- a/src/latex_dependency_scanner/scanner.py +++ b/src/latex_dependency_scanner/scanner.py @@ -39,7 +39,7 @@ r"(<[^<>]*>)?" r"(\[[^\[\]]*\])?" r"({(?P[^{}]*)})?{(?P[^{}]*)}", - re.M, + re.MULTILINE, ) """re.Pattern: The regular expression pattern to extract included files from a LaTeX document.""" diff --git a/tests/test_regex.py b/tests/test_regex.py index c037747..14bf3d5 100644 --- a/tests/test_regex.py +++ b/tests/test_regex.py @@ -3,10 +3,11 @@ from __future__ import annotations import pytest + from latex_dependency_scanner.scanner import REGEX_TEX -@pytest.mark.unit() +@pytest.mark.unit @pytest.mark.parametrize( ("text", "expected"), [ diff --git a/tests/test_scan.py b/tests/test_scan.py index ecff6d7..37de330 100644 --- a/tests/test_scan.py +++ b/tests/test_scan.py @@ -4,16 +4,16 @@ import textwrap import pytest + from latex_dependency_scanner.compile import compile_pdf from latex_dependency_scanner.scanner import COMMON_GRAPHICS_EXTENSIONS from latex_dependency_scanner.scanner import scan - from tests.conftest import TEST_RESOURCES from tests.conftest import needs_latexmk @needs_latexmk -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_document_without_inclusions(tmp_path): source = r""" \documentclass{article} @@ -31,7 +31,7 @@ def test_document_without_inclusions(tmp_path): @needs_latexmk -@pytest.mark.end_to_end() +@pytest.mark.end_to_end @pytest.mark.parametrize("directive", ["include", "input"]) def test_input_or_include(tmp_path, directive): source = f""" @@ -61,7 +61,7 @@ def test_input_or_include(tmp_path, directive): ] -@pytest.mark.end_to_end() +@pytest.mark.end_to_end @pytest.mark.parametrize("directive", ["include", "input"]) def test_input_or_include_without_extension_and_file(tmp_path, directive): source = f""" @@ -83,7 +83,7 @@ def test_input_or_include_without_extension_and_file(tmp_path, directive): @needs_latexmk -@pytest.mark.end_to_end() +@pytest.mark.end_to_end @pytest.mark.parametrize("image_ext", COMMON_GRAPHICS_EXTENSIONS) @pytest.mark.parametrize("has_extension", [True, False]) @pytest.mark.parametrize("file_exists", [True, False]) @@ -108,7 +108,7 @@ def test_includegraphics(tmp_path, image_ext, has_extension, file_exists): \\documentclass{{article}} \\usepackage{{graphicx}} \\begin{{document}} - \\includegraphics{{image{image_ext if has_extension else ''}}} + \\includegraphics{{image{image_ext if has_extension else ""}}} \\end{{document}} """ tmp_path.joinpath("document.tex").write_text(textwrap.dedent(source)) @@ -138,7 +138,7 @@ def test_includegraphics(tmp_path, image_ext, has_extension, file_exists): assert nodes == expected -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_includegraphics_with_beamer_overlay(tmp_path): source = r""" \documentclass{beamer} @@ -157,7 +157,7 @@ def test_includegraphics_with_beamer_overlay(tmp_path): @needs_latexmk -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_import(tmp_path): source = """ \\documentclass{article} @@ -185,7 +185,7 @@ def test_import(tmp_path): ] -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_import_without_extension_and_file(tmp_path): source = """ \\documentclass{article} @@ -205,7 +205,7 @@ def test_import_without_extension_and_file(tmp_path): @needs_latexmk -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_sub_import(tmp_path): source = """ \\documentclass{article} @@ -235,7 +235,7 @@ def test_sub_import(tmp_path): ] -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_sub_import_without_extension_and_file(tmp_path): source = """ \\documentclass{article} @@ -261,7 +261,7 @@ def test_sub_import_without_extension_and_file(tmp_path): @needs_latexmk -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_mixed_import_and_subimport(tmp_path): """Test document with mixed import and subimport directives. @@ -314,7 +314,7 @@ def test_mixed_import_and_subimport(tmp_path): @needs_latexmk -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_natbib_bibliography(tmp_path): source = """ \\documentclass{article} @@ -335,7 +335,7 @@ def test_natbib_bibliography(tmp_path): assert nodes == [tmp_path / "document.tex", tmp_path / "bibliography.bib"] -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_natbib_bibliography_without_extension_and_file(tmp_path): source = """ \\documentclass{article} @@ -354,7 +354,7 @@ def test_natbib_bibliography_without_extension_and_file(tmp_path): @needs_latexmk -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_biblatex_bibliography(tmp_path): """Test document with biblatex bibliography.""" source = """ @@ -376,7 +376,7 @@ def test_biblatex_bibliography(tmp_path): assert nodes == [tmp_path / "document.tex", tmp_path / "bibliography.bib"] -@pytest.mark.end_to_end() +@pytest.mark.end_to_end def test_biblatex_bibliography_without_extension_and_file(tmp_path): """Test document without biblatex bibliography file and extension.""" source = """