Skip to content

tests: make ffmpeg override path portable - #110

Merged
kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
WilliamK112:fix/portable-ffmpeg-override-test
Aug 23, 2026
Merged

tests: make ffmpeg override path portable#110
kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
WilliamK112:fix/portable-ffmpeg-override-test

Conversation

@WilliamK112

Copy link
Copy Markdown
Contributor

Summary

  • replace the Linux-specific /usr/bin/ffmpeg fixture with a real temporary file
  • keep the test focused on the observable override-precedence contract
  • make the regression hermetic across supported Linux and macOS development hosts

Closes #108.

Validation

  • uv run pytest -q tests/test_ffmpeg.py::test_env_override_wins — 1 passed
  • uv run ruff check . — passed
  • uv run ruff format --check . — 99 files already formatted
  • uv run ty check — passed
  • uv run pytest -q -k 'not test_contact_sheet_grid_geometry and not test_contact_sheet_max_tiles_sampling and not test_contact_sheet_accepts_apostrophes_in_external_paths and not test_media_stage_records_a_contact_sheet_artifact' — 398 passed, 6 skipped, 4 deselected

The unfiltered local suite reached 398 passed and 6 skipped, with four unrelated contact-sheet failures because the installed Homebrew FFmpeg build does not provide the drawtext filter. The focused regression and all code-quality gates pass on macOS.

AI assistance disclosure: I used OpenAI Codex to inspect, implement, and validate this change, and reviewed the final diff and evidence.

Signed-off-by: WilliamK112 <164879897+WilliamK112@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

👋 Hi @WilliamK112 — thank you so much for your first contribution to HFlow!

A maintainer will review your pull request as soon as possible. In the meantime:

💡 Tip: one open pull request per contributor at a time. Issues with an assignee are taken; everything else is fair game.

We are excited to have you here and appreciate your help making the project better! 🙌

@promiseeuler promiseeuler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While validating this fix against #108 on macOS, I checked out commit 959ffd4 and ran the exact regression: python -m pytest -q tests/test_ffmpeg.py::test_env_override_wins (1 passed). I also ran ruff check tests/test_ffmpeg.py and ruff format --check tests/test_ffmpeg.py; both passed. Using tmp_path preserves the test's actual purpose—environment-variable precedence—while removing the Linux-only /usr/bin/ffmpeg assumption. The temporary file also satisfies the production existence check, so this is appropriately scoped.

@kstonekuan kstonekuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome, and thank you @WilliamK112. Merging.

Exactly the right scope. ffmpeg_path() validates the override with is_file() and nothing else (src/hflow/ffmpeg/_binary.py:232), so touch() is faithful to the contract rather than a shortcut around it: the test exercises precedence, which is all it ever claimed to.

What I validated on your branch against current main (9d59310): ruff check, ruff format --check, ty check clean, 405 passed and 3 skipped. I also checked that the parallel ffprobe_path() override tests already build their override under tmp_path, so test_env_override_wins was genuinely the only one of its kind and this closes the whole class rather than one instance.

Thank you for disclosing the AI assistance, and for checking the issue was unassigned with no overlapping PR before starting. Both are the right habits here. On the second one: our rule is that an assignee reserves an issue and everything else is fair game, so you read it correctly.

Two notes:

On the four contact-sheet failures you filtered out. Good instinct to separate them from your change and say so. They are a real gap and @promiseeuler has since filed #111 for exactly that (a Homebrew FFmpeg built without drawtext), with a fix in #112. So you were right that it was not you, and it is now tracked.

One more instance of the same species, if you want it. tests/test_video.py:154 falls back to a hardcoded Path("/usr/bin/ffprobe") when the sibling of ffmpeg_path() is missing. It is milder than the bug you fixed, since on macOS the Homebrew sibling normally does exist so the fallback is not reached, but when it is reached it fails the same way for the same reason. The real fix is to call ffprobe_path() from hflow.ffmpeg._binary, which already implements the full resolution policy including the sibling lookup. I will file it; comment there if you would like it.

One thing worth knowing for your next contribution: we cap non-collaborators at one open pull request at a time, so a bot will auto-close a second one with a note. Nothing is lost and it can be reopened once the first merges.

@kstonekuan
kstonekuan merged commit dbae4ae into Hebbian-Robotics:main Aug 23, 2026
5 checks passed
kragent66-glitch added a commit to kragent66-glitch/hflow that referenced this pull request Aug 23, 2026
…_video.py

Fixes Hebbian-Robotics#115

Replaced the manual ffprobe resolution logic in _ffprobe_video_stream_fields()
with a single call to ffprobe_path(), following the pattern from PR Hebbian-Robotics#110.

- Added ffprobe_path to imports from hflow.ffmpeg
- Removed hardcoded /usr/bin/ffprobe fallback
- All 9 tests in test_video.py pass
kstonekuan pushed a commit that referenced this pull request Aug 23, 2026
…_video.py (#119)

Fixes #115

Replaced the manual ffprobe resolution logic in _ffprobe_video_stream_fields()
with a single call to ffprobe_path(), following the pattern from PR #110.

- Added ffprobe_path to imports from hflow.ffmpeg
- Removed hardcoded /usr/bin/ffprobe fallback
- All 9 tests in test_video.py pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests: test_env_override_wins hardcodes Linux ffmpeg path on macOS

3 participants