From 4346f75eac47bbfa508fe0a4dd647230031c2ce2 Mon Sep 17 00:00:00 2001 From: beefcarver Date: Wed, 4 Nov 2026 16:20:38 -0500 Subject: [PATCH] test: spawn fake mpv and parec helpers with sys.executable --- tests/test_player.py | 4 ++-- tests/test_spectrum.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_player.py b/tests/test_player.py index 1ffbcc6..d6260d0 100644 --- a/tests/test_player.py +++ b/tests/test_player.py @@ -2,13 +2,13 @@ from __future__ import annotations import os import queue +import sys import time from pathlib import Path from beefy_player.player import Player -FAKE_MPV = '''#!/usr/bin/env python3 -import json, os, socket, sys, time +FAKE_MPV = f"#!{sys.executable}\n" + '''import json, os, socket, sys, time sock_path = None volume = 70 diff --git a/tests/test_spectrum.py b/tests/test_spectrum.py index 507796a..8b36b5c 100644 --- a/tests/test_spectrum.py +++ b/tests/test_spectrum.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys import time from pathlib import Path @@ -8,8 +9,7 @@ import numpy as np from beefy_player import spectrum as spectrum_module from beefy_player.spectrum import Frame, SpectrumEngine -PCM_SCRIPT = """#!/usr/bin/env python3 -import math, struct, sys, time +PCM_SCRIPT = f"#!{sys.executable}\n" + """import math, struct, sys, time sr = 44100 samples = [int(0.6 * 32767 * math.sin(2 * math.pi * 1000 * i / sr)) for i in range(4096)] chunk = struct.pack("<%dh" % len(samples), *samples) @@ -303,7 +303,7 @@ def test_tap_audio_is_downmixed_and_retuned() -> None: def test_dead_monitor_falls_back_instead_of_flat_bars(tmp_path) -> None: script = tmp_path / "silent-parec" script.write_text( - "#!/usr/bin/env python3\n" + f"#!{sys.executable}\n" "import sys\n" "block = b'\\0' * 4096\n" "for _ in range(1000):\n" @@ -333,7 +333,7 @@ def test_monitor_survives_silence_after_audio(tmp_path, monkeypatch) -> None: # replaced by the drifting stream tap) for the rest of the session. script = tmp_path / "parec" script.write_text( - "#!/usr/bin/env python3\n" + f"#!{sys.executable}\n" "import math, struct, sys, time\n" "sr = 44100\n" "n = 2048\n"