Skip to content

test: strengthen audio playback coverage#5087

Merged
abdnh merged 7 commits into
mainfrom
test/audio-playback-coverage
Jul 2, 2026
Merged

test: strengthen audio playback coverage#5087
abdnh merged 7 commits into
mainfrom
test/audio-playback-coverage

Conversation

@fernandolins

Copy link
Copy Markdown
Contributor

Linked issue

Refs #5016

Summary / motivation

Adds follow-up test coverage for audio playback after #5066.

This strengthens the previous basic sound tests by covering additional edge cases in anki.sound and by adding a real mpv playback smoke test. The goal is to catch regressions where the mpv binary exists and responds to --version, but fails to actually load/decode/play an audio file in Anki's automated environment.

Coverage added:

  • SoundOrVideoTag.path() with filenames containing directory separators
  • hooks.media_file_filter application in sound tag path resolution
  • case-insensitive audio extension detection
  • rejection of filenames without extensions
  • _packagedCmd() preference for anki_audio only on macOS/Windows
  • generated WAV playback through mpv in headless mode

Steps to reproduce

  1. Have a broken or incompatible mpv/anki_audio binary available.
  2. Run the sound-related Python tests.
  3. Without a playback smoke test, mpv --version may pass even if mpv cannot load/play an audio file.

How to test

Run:

just test-py

Both passed locally.

The mpv smoke test generates a minimal WAV file and runs mpv with headless/null audio-video output, so it validates decoding/playback without requiring audio hardware.

Before / after behavior

Before: coverage verified that mpv existed and responded to --version, but did not prove it could play/decode an audio file.

After: tests verify that mpv can load and play a generated WAV file in an automated headless mode.

fernandolins added a commit that referenced this pull request Jul 1, 2026
## Summary / motivation

Two related bugs in the `check-linked-issue` workflow caused unnecessary
noise on PRs:

1. **Wrong keywords**: the regex only accepted `closes`, `fixes`, and
`resolves` variants, but the PR template explicitly shows `Refs #123` as
a valid option. Any PR using `Refs #NNN`, `Ref #NNN`, or `References
#NNN` was incorrectly flagged. Observed in #5087.

2. **Stale bot comment**: once the contributor added an issue link and
the `missing-issue` label was removed, the bot's warning comment
remained visible on the PR, creating unnecessary noise.

## Steps to reproduce (required, use N/A if not applicable)

1. Open a PR with `Refs #<open issue>` in the linked issue section
(following the template hint).
2. Bot applies `missing-issue` label and posts a comment despite the
issue being referenced.
3. Edit the PR description to use `Closes #NNN` instead, label is
removed but the bot comment stays.

## How to test (required)

1. Open a draft PR with no issue link → verify label and comment are
applied.
2. Edit the description to add `Refs #NNN` → verify label and comment
are both removed.
3. Repeat with `Closes #NNN`, `Fixes #NNN`, `References #NNN`.

## Risk / compatibility / migration

No Risk, CI workflow only.
@abdnh abdnh added check:macos Run macOS checks for a PR check:windows Run windows checks for a PR labels Jul 1, 2026
@fernandolins

Copy link
Copy Markdown
Contributor Author

@abdnh I fixed the tests for Windows.

@abdnh abdnh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Added a test for MpvManager, which is what I was mainly interested in testing since the original issue was caused by an argument passed to mpv there.

@abdnh abdnh merged commit b90c8ab into main Jul 2, 2026
6 of 7 checks passed
@abdnh abdnh deleted the test/audio-playback-coverage branch July 2, 2026 11:32
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Anki Projects Jul 2, 2026
abdnh added a commit that referenced this pull request Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

check:macos Run macOS checks for a PR check:windows Run windows checks for a PR

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants