ankitects / ankitects/anki

The MpvManager playback test returns before playback and leaves its player running

Aperta
#5,577 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
30.5k
Fork
3.2k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

`test_mpvmanager_can_play_generated_wav` starts playback and immediately returns. It has no assertion that the generated file loaded or finished, and it does not shut down the player.

Reproduction:
1. On a supported macOS/Windows checkout with the bundled mpv available, run `just test-py`.
2. The test is reported as passed after `manager.play()` returns, before asynchronous playback completes.
3. The player can still be running when pytest restores the `aqt.mw` monkeypatch. A late callback may then access restored global state instead of the test double.

Expected: the test observes a successful file load and playback completion, then shuts down the process even when an assertion fails.
Actual: it can pass without observing playback and leaves an asynchronous player outside the test lifetime.

Source diagnosis: the mocked `run_on_main` never executes its callback; the supplied callback incorrectly requires an argument even though `OnDoneCallback` takes none; and no cleanup runs. Waiting only for the idle callback would also allow a missing-file error to look like successful playback, so the test should separately observe `file-loaded`.

This is a test-only issue. The existing generated WAV, temporary directory, bundled-player resolution, null audio/video outputs, and platform skip can be retained.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.