Skip to content

Commit 8b922da

Browse files
claudestanislaw
authored andcommitted
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).
1 parent b164b5d commit 8b922da

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

ruff.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ ignore = [
7272
# Too many statements
7373
"PLR0915",
7474

75+
# Too many arguments
76+
"PLR0917",
77+
7578
# TBD: Enable: Use `sys.exit()` instead of `exit`
7679
"PLR1722",
7780

tests/integration/20_fuzz_integration/test.itest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
RUN: mkdir -p %project_root/build/tests_integration_fuzz/
55
RUN: cp -rv %project_root/tests/fuzz/01_strictdoc_guide_202510 %project_root/build/tests_integration_fuzz/
66

7-
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
8-
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
7+
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
8+
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
99
CHECK: html2pdf4doc_fuzzer: finished ✅ — Success rate: 1/1 (100.0%)

tests/integration/40_sdoc_only_child_does_not_break_page_when_surrounded_by_text_nodes/test.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
#
1515

1616
page2_text_normalized = (
17-
reader.pages[2].extract_text().replace("leo.StrictDoc", "leo.\nStrictDoc")
17+
reader.pages[2]
18+
.extract_text()
19+
.replace("leo.StrictDoc", "leo.\nStrictDoc")
20+
.replace("3 / 4", "3/4")
1821
)
1922
assert (
2023
page2_text_normalized
@@ -28,7 +31,10 @@
2831
), page2_text_normalized
2932

3033
page3_text_normalized = (
31-
reader.pages[3].extract_text().replace("cStrictDoc", "c\nStrictDoc")
34+
reader.pages[3]
35+
.extract_text()
36+
.replace("cStrictDoc", "c\nStrictDoc")
37+
.replace("4 / 4", "4/4")
3238
)
3339

3440
assert (

tests/integration/lit.cfg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
lit_config: Any
88

99
config.name = "html2pdf4doc Python API integration tests"
10-
config.test_format = lit.formats.ShTest("0")
10+
config.test_format = lit.formats.ShTest()
1111

1212
current_dir = os.getcwd().replace("\\", "/")
1313

0 commit comments

Comments
 (0)