Skip to content

tests: test_env_override_wins hardcodes Linux ffmpeg path on macOS #108

Description

@promiseeuler

Summary

While validating PR #107 on macOS, I found that test_env_override_wins hardcodes /usr/bin/ffmpeg. The implementation correctly rejects nonexistent override paths, so the test fails on supported macOS installations where FFmpeg is normally elsewhere (for example, Homebrew uses /opt/homebrew/bin/ffmpeg on Apple Silicon).

Environment

  • HFlow upstream main (verified against the current raw source on 2026-08-22)
  • macOS, Apple Silicon
  • Python 3.14.2
  • uv 0.12.5
  • FFmpeg installed and available on PATH, but not at /usr/bin/ffmpeg

Steps to reproduce

uv sync --locked --all-extras
uv run pytest -q tests/test_ffmpeg.py::test_env_override_wins

Expected behavior

The platform-supported test should verify that an existing override path wins without depending on a Linux-specific filesystem location.

Actual behavior

E hflow.ffmpeg._binary.FfmpegNotFoundError:
E HFLOW_FFMPEG=/usr/bin/ffmpeg does not exist
1 failed

The failure is deterministic because ffmpeg_path() intentionally checks Path(override).is_file().

Possible cause

tests/test_ffmpeg.py:67 sets:

monkeypatch.setenv(FFMPEG_ENV_VAR, "/usr/bin/ffmpeg")

That path is not portable to macOS, despite CONTRIBUTING.md listing macOS as a supported native development platform.

Proposed solution

Create a temporary file with tmp_path, set HFLOW_FFMPEG to that path, and assert the resolver returns it. The test only exercises path precedence, so it does not need a real executable:

def test_env_override_wins(
    tmp_path: Path,
    monkeypatch: pytest.MonkeyPatch,
    cleared_binary_caches: None,
) -> None:
    override = tmp_path / "ffmpeg"
    override.touch()
    monkeypatch.setenv(FFMPEG_ENV_VAR, str(override))
    assert ffmpeg_path() == override

This keeps the test hermetic and platform-independent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions