From 1864cfb088f039be91693879cf19f9b458e3c88f Mon Sep 17 00:00:00 2001 From: pax Date: Sat, 11 Apr 2026 17:28:47 -0500 Subject: [PATCH] test_pil_safety: target core.config instead of core.images The 'audit #8 invariant' the test was anchored on (core.images imported without core.cache first) is about to become moot when images.py is removed in a follow-up commit. Swap to core.config to keep the same coverage shape: any non-cache submodule import must still trigger __init__.py and install the PIL cap. --- tests/core/test_pil_safety.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/core/test_pil_safety.py b/tests/core/test_pil_safety.py index 6ac135c..793e4b6 100644 --- a/tests/core/test_pil_safety.py +++ b/tests/core/test_pil_safety.py @@ -35,11 +35,12 @@ def test_core_package_import_installs_cap(): assert int(out) == EXPECTED -def test_core_images_import_installs_cap(): - """The original audit concern: importing core.images without first - importing core.cache must still set the cap.""" +def test_core_submodule_import_installs_cap(): + """Importing any non-cache core submodule must still set the cap — + the invariant is that the package __init__.py runs before any + submodule code, regardless of which submodule is the entry point.""" out = _run( - "from booru_viewer.core import images; " + "from booru_viewer.core import config; " "from PIL import Image; " "print(Image.MAX_IMAGE_PIXELS)" )