From 8b922da442c26dbf09a5df0cc70e89c2276296cc Mon Sep 17 00:00:00 2001 From: Claude Sonnet 5 Date: Thu, 27 Aug 2026 08:49:08 +0200 Subject: [PATCH] chore(tests/integration): adapt lit tests to newer lit and pypdf - lit.cfg.py: use lit's internal shell (the previous ShTest("0") call accidentally kept execute_external=True since "0" is truthy, which is now rejected by lit as deprecated). - 20_fuzz_integration/test.itest: drop the inline PYTHONPATH=%project_root prefix, which lit's internal shell does not support; PYTHONPATH is already exported globally in lit.cfg.py. - 40_sdoc_only_child_.../test.py: normalize the spacing pypdf now inserts around "/" in extracted page-number text (e.g. "3/4" -> "3 / 4"), matching the existing portability-replace() pattern. - ruff.toml: ignore PLR0917 (too many arguments). --- ruff.toml | 3 +++ tests/integration/20_fuzz_integration/test.itest | 4 ++-- .../test.py | 10 ++++++++-- tests/integration/lit.cfg.py | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ruff.toml b/ruff.toml index a4cb9a1..aa89757 100644 --- a/ruff.toml +++ b/ruff.toml @@ -72,6 +72,9 @@ ignore = [ # Too many statements "PLR0915", + # Too many arguments + "PLR0917", + # TBD: Enable: Use `sys.exit()` instead of `exit` "PLR1722", diff --git a/tests/integration/20_fuzz_integration/test.itest b/tests/integration/20_fuzz_integration/test.itest index 850f444..4da182f 100644 --- a/tests/integration/20_fuzz_integration/test.itest +++ b/tests/integration/20_fuzz_integration/test.itest @@ -4,6 +4,6 @@ RUN: mkdir -p %project_root/build/tests_integration_fuzz/ RUN: cp -rv %project_root/tests/fuzz/01_strictdoc_guide_202510 %project_root/build/tests_integration_fuzz/ -RUN: PYTHONPATH=%project_root python -m html2pdf4doc.main_fuzzer %project_root/build/tests_integration_fuzz/01_strictdoc_guide_202510/strictdoc/docs/strictdoc_01_user_guide-PDF.html %project_root/build/tests_integration_fuzz/01_strictdoc_guide_202510 %T/ --total-mutations 1 --mutations=random | filecheck %s --dump-input=fail -RUN: PYTHONPATH=%project_root python -m html2pdf4doc.main_fuzzer %project_root/build/tests_integration_fuzz/01_strictdoc_guide_202510/strictdoc/docs/strictdoc_01_user_guide-PDF.html %project_root/build/tests_integration_fuzz/01_strictdoc_guide_202510 %T/ --total-mutations 1 --mutations=incremental | filecheck %s --dump-input=fail +RUN: python -m html2pdf4doc.main_fuzzer %project_root/build/tests_integration_fuzz/01_strictdoc_guide_202510/strictdoc/docs/strictdoc_01_user_guide-PDF.html %project_root/build/tests_integration_fuzz/01_strictdoc_guide_202510 %T/ --total-mutations 1 --mutations=random | filecheck %s --dump-input=fail +RUN: python -m html2pdf4doc.main_fuzzer %project_root/build/tests_integration_fuzz/01_strictdoc_guide_202510/strictdoc/docs/strictdoc_01_user_guide-PDF.html %project_root/build/tests_integration_fuzz/01_strictdoc_guide_202510 %T/ --total-mutations 1 --mutations=incremental | filecheck %s --dump-input=fail CHECK: html2pdf4doc_fuzzer: finished ✅ — Success rate: 1/1 (100.0%) diff --git a/tests/integration/40_sdoc_only_child_does_not_break_page_when_surrounded_by_text_nodes/test.py b/tests/integration/40_sdoc_only_child_does_not_break_page_when_surrounded_by_text_nodes/test.py index 0730dd3..2ee147d 100644 --- a/tests/integration/40_sdoc_only_child_does_not_break_page_when_surrounded_by_text_nodes/test.py +++ b/tests/integration/40_sdoc_only_child_does_not_break_page_when_surrounded_by_text_nodes/test.py @@ -14,7 +14,10 @@ # page2_text_normalized = ( - reader.pages[2].extract_text().replace("leo.StrictDoc", "leo.\nStrictDoc") + reader.pages[2] + .extract_text() + .replace("leo.StrictDoc", "leo.\nStrictDoc") + .replace("3 / 4", "3/4") ) assert ( page2_text_normalized @@ -28,7 +31,10 @@ ), page2_text_normalized page3_text_normalized = ( - reader.pages[3].extract_text().replace("cStrictDoc", "c\nStrictDoc") + reader.pages[3] + .extract_text() + .replace("cStrictDoc", "c\nStrictDoc") + .replace("4 / 4", "4/4") ) assert ( diff --git a/tests/integration/lit.cfg.py b/tests/integration/lit.cfg.py index dd7d730..bbf02fb 100644 --- a/tests/integration/lit.cfg.py +++ b/tests/integration/lit.cfg.py @@ -7,7 +7,7 @@ lit_config: Any config.name = "html2pdf4doc Python API integration tests" -config.test_format = lit.formats.ShTest("0") +config.test_format = lit.formats.ShTest() current_dir = os.getcwd().replace("\\", "/")