The app is now a general internet-radio player rather than a SomaFM client, so the package, console script, MPRIS identity, mpv namespaces, macOS tap names, XDG directories and docs all move to beefy-player. Environment variables are now BEEFY_* (the old SOMAFM_* spellings are still honoured) and an existing ~/.config/somafm-tui/config.json is migrated on first run, so favourites and volume survive the rename. The visible interface is untouched: same layout, same logo, same keys.
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from beefy_player import macos_tap
|
|
|
|
|
|
def test_osstatus_decodes_four_character_codes() -> None:
|
|
# 'who?' is kAudioHardwareBadObjectError.
|
|
assert macos_tap._osstatus(int.from_bytes(b"who?", "big")) == "'who?'"
|
|
assert macos_tap._osstatus(-50) == "-50"
|
|
|
|
|
|
def test_start_raises_without_the_native_api(monkeypatch) -> None:
|
|
monkeypatch.setattr(macos_tap, "available", lambda: False)
|
|
tap = macos_tap.SystemAudioTap()
|
|
with pytest.raises(macos_tap.TapError):
|
|
tap.start()
|
|
assert tap.running is False
|
|
tap.stop() # tearing down a tap that never started is safe
|
|
|
|
|
|
def test_read_returns_none_when_not_running() -> None:
|
|
tap = macos_tap.SystemAudioTap()
|
|
assert tap.read(0.0) is None
|
|
|
|
|
|
def test_uses_no_external_helpers() -> None:
|
|
# The tap must never shell out: no helper binary, no ffmpeg, no driver.
|
|
import inspect
|
|
|
|
source = inspect.getsource(macos_tap).casefold()
|
|
assert "subprocess" not in source
|
|
assert "avfoundation" not in source
|