From 112879db7a458a0b4b35ae76c0f4133f52c04e25 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Tue, 1 Jul 2025 18:37:31 +0100 Subject: [PATCH 1/4] scripts/test.py: venv_run(): fix arg quoting on windows. --- scripts/test.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/test.py b/scripts/test.py index 42dab0a22..29f5dea84 100755 --- a/scripts/test.py +++ b/scripts/test.py @@ -1128,10 +1128,14 @@ def venv_run(args, path, recreate=True): if recreate or not os.path.isdir(path): run(f'{sys.executable} -m venv {path}') if platform.system() == 'Windows': - command = f'{path}\\Scripts\\activate' + command = f'{path}\\Scripts\\activate && python' + # shlex not reliable on Windows. + # Use crude quoting with "...". Seems to work. + for arg in args: + assert '"' not in arg + command += f' "{arg}"' else: - command = f'. {path}/bin/activate' - command += f' && python {shlex.join(args)}' + command = f'. {path}/bin/activate && python {shlex.join(args)}' e = run(command, check=0) return e From 3e05f21ffd48ce419bee59872bf9387b372692db Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Tue, 1 Jul 2025 17:18:19 +0100 Subject: [PATCH 2/4] tests/test_story.py: test_story(): update to work with latest mupdf. Latest mupdf master has footer spacing so we need to give more space otherwise there will be spurious page breaks. --- tests/test_story.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_story.py b/tests/test_story.py index 1f1f1b396..d895e9b58 100644 --- a/tests/test_story.py +++ b/tests/test_story.py @@ -38,7 +38,7 @@ def test_story(): def test_2753(): def rectfn(rect_num, filled): - return pymupdf.Rect(0, 0, 200, 200), pymupdf.Rect(50, 50, 100, 100), None + return pymupdf.Rect(0, 0, 200, 200), pymupdf.Rect(50, 50, 100, 150), None def make_pdf(html, path_out): story = pymupdf.Story(html=html) @@ -65,6 +65,9 @@ def make_pdf(html, path_out): os.path.abspath(f'{__file__}/../../tests/test_2753-out-after.pdf'), ) + path = os.path.normpath(f'{__file__}/../../tests/test_2753_out') + doc_before.save(f'{path}_before.pdf') + doc_after.save(f'{path}_after.pdf') assert len(doc_before) == 2 assert len(doc_after) == 2 From 9cec994a9a1045c783f7d19084db53f08957697a Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Tue, 1 Jul 2025 17:18:42 +0100 Subject: [PATCH 3/4] .github/workflows/test.yml: use windows-2022. Github no longer supports windows-2019. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3a02c1fee..c7b59c722 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,7 +26,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-2019, macos-13, macos-14] + os: [ubuntu-latest, windows-2022, macos-13, macos-14] # Avoid cancelling of all runs after a single failure. fail-fast: false From ae97269e86b64c81c76896e659de3a85ebcf04e9 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Tue, 1 Jul 2025 17:45:13 +0100 Subject: [PATCH 4/4] .github/workflows/test_multiple.yml: new, for testing with different mupdf's. --- .github/workflows/test_multiple.yml | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/test_multiple.yml diff --git a/.github/workflows/test_multiple.yml b/.github/workflows/test_multiple.yml new file mode 100644 index 000000000..801671b52 --- /dev/null +++ b/.github/workflows/test_multiple.yml @@ -0,0 +1,39 @@ +# Run scripts/test.py on multiple OS's (Windows, Linux, MacOS x64, MacOS arm64) +# and with multiple specifications of MuPDF (PyMuPDF's hard-coded default, +# master branch, release branch). + +name: multiple + +on: + workflow_dispatch: + inputs: + args: + type: string + default: '' + description: 'Arguments to pass to scripts/test.py' + schedule: + - cron: '13 6 * * *' + +jobs: + + multiple: + name: multiple + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-2022, macos-13, macos-14] + args: [ + '', + '-m "git:--branch master https://github.com/ArtifexSoftware/mupdf"', + '-m "git:--branch 1.26.x https://github.com/ArtifexSoftware/mupdf"', + ] + fail-fast: false + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - name: multiple + env: + PYMUPDF_test_args: ${{inputs.args}} + run: + python scripts/test.py ${{matrix.args}} wheel test -a PYMUPDF_test_args