diff --git a/backend/tests/test_plex_subtitle_prepare.py b/backend/tests/test_plex_subtitle_prepare.py index 53085c17..fcaa4aa0 100644 --- a/backend/tests/test_plex_subtitle_prepare.py +++ b/backend/tests/test_plex_subtitle_prepare.py @@ -22,6 +22,7 @@ conftest refuses to run without ffmpeg rather than let it skip. """ import asyncio +import errno import shutil import subprocess import sys @@ -1059,7 +1060,17 @@ def test_an_absurd_rating_key_or_ordinal_is_refused_not_a_500(client, monkeypatc ): assert client.get(url).status_code == 422, url assert pool.jobs == [] - # …and the cache helpers themselves no longer throw on such a name. + + # …and the cache helpers themselves no longer throw on such a name. Asserted against a forced + # ENAMETOOLONG rather than the real filesystem: on Linux pathlib re-raises it (the defect), but + # Windows reports ERROR_INVALID_NAME, which pathlib's `exists()` already swallows — so on a dev + # machine this assertion passed with `_exists` reverted and only the container lane was honest + # about it (deep-review round 5). + def _too_long(self): + raise OSError(errno.ENAMETOOLONG, "File name too long") + + monkeypatch.setattr(Path, "exists", _too_long) + assert subtitles._exists(Path("whatever")) is False assert subtitles.read_meta(subtitles.cache_key(long_key, 0)) == ([], False)