diff --git a/changes.txt b/changes.txt index ff33fb6a0..eaa5e3ccb 100644 --- a/changes.txt +++ b/changes.txt @@ -8,6 +8,7 @@ Change Log * **Fixed** `4699 `_: cannot find ExtGState resource * **Fixed** `4712 `_: Crash with "corrupted double-linked list" + * **Fixed** `4720 `_: Memory leaking in rewrite_images? * **Fixed** `4742 `_: 'Rect' object has no attribute 'get_area' * **Fixed** `4746 `_: Document.__init__() got an unexpected keyword argument 'encoding' diff --git a/scripts/test.py b/scripts/test.py index 986b8c7f4..8c175c00a 100755 --- a/scripts/test.py +++ b/scripts/test.py @@ -162,10 +162,17 @@ --graal Use graal - run inside a Graal VM instead of a Python venv. - As of 2025-08-04 we: - * Clone the latest pyenv and build it. - * Use pyenv to install graalpy. - * Use graalpy to create venv. + As of 2025-08-04, if specified: + * We assert-fail if cibw and non-cibw commands are specified. + * If `cibw` is specified: + * We use a conventional venv. + * We set CIBW_ENABLE=graalpy. + * We set CIBW_BUILD = 'gp*'. + * Otherwise: + * We don't create a conventional venv. + * Clone the latest pyenv and build it. + * Use pyenv to install graalpy. + * Use graalpy to create venv. [After the first time, suggest `-v 1` to avoid delay from updating/building pyenv and recreating the graal venv.] diff --git a/setup.py b/setup.py index 2536feb8f..49557d559 100755 --- a/setup.py +++ b/setup.py @@ -1410,7 +1410,8 @@ def platform_release_tuple(): elif openbsd: print(f'OpenBSD: pip install of swig does not build; assuming `pkg_add swig`.') else: - ret.append( 'swig') + # 2025-10-27: new swig-4.4.0 fails badly at runtime. + ret.append( 'swig==4.3.1') return ret diff --git a/tests/conftest.py b/tests/conftest.py index 06af5b7aa..8b9bd31b8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,11 +1,40 @@ import copy import os import platform +import subprocess import sys +import pytest + +# Install required packages. There doesn't seem to be any official way for +# us to programmatically specify required test packages in setup.py, or in +# pytest. Doing it here seems to be the least ugly approach. +# +# However our diagnostics do not show up so this can cause an unfortunate pause +# before tests start to run. +# +def install_required_packages(): + packages = 'pytest fontTools pymupdf-fonts flake8 pylint codespell' + if platform.system() == 'Windows' and int.bit_length(sys.maxsize+1) == 32: + # No pillow wheel available, and doesn't build easily. + pass + else: + packages += ' pillow' + if platform.system().startswith('MSYS_NT-'): + # psutil not available on msys2. + pass + else: + packages += ' psutil' + command = f'pip install --upgrade {packages}' + print(f'{__file__}:install_required_packages)(): Running: {command}', flush=1) + subprocess.run(command, shell=1, check=1) + +install_required_packages() + +# Need to import pymupdf only after we've installed pymupdf-fonts above, +# because pymupdf imports pymupdf_fonts, and copes with import failure. import pymupdf -import pytest PYMUPDF_PYTEST_RESUME = os.environ.get('PYMUPDF_PYTEST_RESUME')