Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/test_multiple.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 7 additions & 3 deletions scripts/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion tests/test_story.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down
Loading