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.
This commit is contained in:
pax 2026-04-11 17:28:47 -05:00
parent a849b8f900
commit 1864cfb088

View File

@ -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)"
)