From 2ed8833640f060688e7387e2985e5c89402e39fd Mon Sep 17 00:00:00 2001 From: abrichr Date: Fri, 28 Aug 2026 13:58:15 -0400 Subject: [PATCH] fix(test): do not assert a POSIX execute bit on Windows test_install_writes_verified_files_and_a_receipt asserted st_mode & 0o100 on the installed ffmpeg. Windows has no execute bit: st_mode is 0o666 or 0o444 there and chmod only toggles read-only, so the assertion could never hold and test-windows went red on main after #118. The install-and-encode lane in ffmpeg-pin.yml already proves the installed runtime actually runs on windows-latest, which is the property this assertion was reaching for. Keep the mode checks on POSIX and check readability on Windows. Co-Authored-By: Claude Opus 5 --- tests/test_ffmpeg_provision.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/test_ffmpeg_provision.py b/tests/test_ffmpeg_provision.py index 866ecb5..d7b42f3 100644 --- a/tests/test_ffmpeg_provision.py +++ b/tests/test_ffmpeg_provision.py @@ -10,6 +10,7 @@ import hashlib import io import json +import os import pathlib import re import zipfile @@ -188,11 +189,19 @@ def test_install_writes_verified_files_and_a_receipt(synthetic) -> None: ffmpeg = Path(installed.ffmpeg) assert ffmpeg.read_bytes() == members["bin/ffmpeg"] - assert ffmpeg.stat().st_mode & 0o100, "ffmpeg is not executable" - assert Path(installed.ffprobe).stat().st_mode & 0o100 licence = Path(installed.license_path) assert licence.read_bytes() == members["LICENSES/FFmpeg-LGPL-2.1-or-later.txt"] - assert not licence.stat().st_mode & 0o111, "the licence text must not be executable" + + if os.name == "posix": + assert ffmpeg.stat().st_mode & 0o100, "ffmpeg is not executable" + assert Path(installed.ffprobe).stat().st_mode & 0o100 + assert not licence.stat().st_mode & 0o111, "the licence text must not be executable" + else: + # Windows has no execute bit: st_mode carries 0o666 or 0o444 and chmod + # only toggles read-only. Runnability is proven instead by the + # install-and-encode lane in .github/workflows/ffmpeg-pin.yml. + assert os.access(ffmpeg, os.R_OK) + assert os.access(Path(installed.ffprobe), os.R_OK) # Only pinned members are installed. Unpinned provenance is left behind. assert not (ffmpeg.parent.parent / "PROVENANCE").exists()