Skip to content

Use pathlib.Path to find test images and fonts - #10079

Merged
radarhere merged 3 commits into
python-pillow:mainfrom
akx:fuzz-subprocess
Sep 29, 2026
Merged

radarhere merged 3 commits into
python-pillow:mainfrom
akx:fuzz-subprocess

Conversation

@akx

@akx akx commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Just something I noticed. Felt a little silly to spawn a shell and find when rglob does the trick.

Comment thread Tests/helper.py Outdated
@akx
akx requested a review from hugovk September 29, 2026 07:23
@radarhere

Copy link
Copy Markdown
Member

My instinct would be to put the new functions in test_fuzzers.py, rather than in helpers.py? They are only used there, and it is unlikely that we'd find another purpose for them.

@akx

akx commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

They are only used there, and it is unlikely that we'd find another purpose for them.

Sure thing.

@akx

akx commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Inlined into test_fuzzers.py, with even better test IDs. 👍

Comment thread Tests/oss-fuzz/test_fuzzers.py Outdated
Comment thread Tests/oss-fuzz/test_fuzzers.py Outdated
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Comment thread Tests/oss-fuzz/test_fuzzers.py Outdated
Comment thread Tests/oss-fuzz/test_fuzzers.py Outdated
@akx

akx commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Btw, speaking of pathlib use (akx#35), many tests would be shorter/simplified if tests used more pathlib.Paths throughout (.read_bytes() etc. instead of strings and with ... + .read()).

I could do that cleanup, but are there maintainer opinions about how aggressively e.g. TEST_FILE globals etc. should become pathlib.Paths instead of just strings?

Something like akx@dab74b9 but a wider sweep.

Comment thread Tests/oss-fuzz/test_fuzzers.py Outdated
@radarhere
radarhere enabled auto-merge (squash) September 29, 2026 13:08
@radarhere radarhere changed the title Don't use subprocess to find test images and fonts Use pathlib.Path to find test images and fonts Sep 29, 2026
@radarhere
radarhere merged commit b25d853 into python-pillow:main Sep 29, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants