test: spawn fake mpv and parec helpers with sys.executable
This commit is contained in:
1 parent
e0e1ad5df3
commit
4346f75eac
2 files changed
+6
-6
No files matched your search
@@ -2,13 +2,13 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from beefy_player.player import Player
|
from beefy_player.player import Player
|
||||||
|
|
||||||
FAKE_MPV = '''#!/usr/bin/env python3
|
FAKE_MPV = f"#!{sys.executable}\n" + '''import json, os, socket, sys, time
|
||||||
import json, os, socket, sys, time
|
|
||||||
|
|
||||||
sock_path = None
|
sock_path = None
|
||||||
volume = 70
|
volume = 70
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -8,8 +9,7 @@ import numpy as np
|
|||||||
from beefy_player import spectrum as spectrum_module
|
from beefy_player import spectrum as spectrum_module
|
||||||
from beefy_player.spectrum import Frame, SpectrumEngine
|
from beefy_player.spectrum import Frame, SpectrumEngine
|
||||||
|
|
||||||
PCM_SCRIPT = """#!/usr/bin/env python3
|
PCM_SCRIPT = f"#!{sys.executable}\n" + """import math, struct, sys, time
|
||||||
import math, struct, sys, time
|
|
||||||
sr = 44100
|
sr = 44100
|
||||||
samples = [int(0.6 * 32767 * math.sin(2 * math.pi * 1000 * i / sr)) for i in range(4096)]
|
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)
|
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:
|
def test_dead_monitor_falls_back_instead_of_flat_bars(tmp_path) -> None:
|
||||||
script = tmp_path / "silent-parec"
|
script = tmp_path / "silent-parec"
|
||||||
script.write_text(
|
script.write_text(
|
||||||
"#!/usr/bin/env python3\n"
|
f"#!{sys.executable}\n"
|
||||||
"import sys\n"
|
"import sys\n"
|
||||||
"block = b'\\0' * 4096\n"
|
"block = b'\\0' * 4096\n"
|
||||||
"for _ in range(1000):\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.
|
# replaced by the drifting stream tap) for the rest of the session.
|
||||||
script = tmp_path / "parec"
|
script = tmp_path / "parec"
|
||||||
script.write_text(
|
script.write_text(
|
||||||
"#!/usr/bin/env python3\n"
|
f"#!{sys.executable}\n"
|
||||||
"import math, struct, sys, time\n"
|
"import math, struct, sys, time\n"
|
||||||
"sr = 44100\n"
|
"sr = 44100\n"
|
||||||
"n = 2048\n"
|
"n = 2048\n"
|
||||||
|
|||||||
Reference in new issue
Block a user