From 5201383638982b47767881df4ad5492f2e7cd7fd Mon Sep 17 00:00:00 2001 From: Xavier Karma Date: Sat, 7 Nov 2026 00:02:41 +0530 Subject: [PATCH] fix(audio): apply host_env outermost to the pw-record spawn host_env() now wraps the whole child environment, and the stream.capture.sink property is merged inside it, which is the form the host_process convention expects. The two capture tests patch os.environ instead of host_env. Fixes #41 --- src/vocalinux/audio/pipewire.py | 2 +- tests/test_pipewire_capture.py | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/vocalinux/audio/pipewire.py b/src/vocalinux/audio/pipewire.py index d658152..0d6ca9a 100644 --- a/src/vocalinux/audio/pipewire.py +++ b/src/vocalinux/audio/pipewire.py @@ -401,7 +401,7 @@ class PipeWireCaptureSource: ], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, - env=_capture_sink_env(host_env()), + env=host_env(_capture_sink_env(os.environ)), ) def reopen( diff --git a/tests/test_pipewire_capture.py b/tests/test_pipewire_capture.py index dd22565..e2fda6e 100644 --- a/tests/test_pipewire_capture.py +++ b/tests/test_pipewire_capture.py @@ -355,7 +355,7 @@ class TestPipeWireCaptureSource(unittest.TestCase): calls: List[Tuple[List[str], Dict[str, Any]]] = [] with ( patch("vocalinux.audio.pipewire.resolve_pipewire_source", return_value=_source()), - patch("vocalinux.audio.pipewire.host_env", return_value={"PATH": "/usr/bin"}), + patch.dict("os.environ", {"PATH": "/usr/bin"}, clear=True), ): capture = PipeWireCaptureSource( device_index=PIPEWIRE_INDEX_BASE, @@ -374,10 +374,7 @@ class TestPipeWireCaptureSource(unittest.TestCase): user_props = "{ node.latency = 1024/48000 }" with ( patch("vocalinux.audio.pipewire.resolve_pipewire_source", return_value=_source()), - patch( - "vocalinux.audio.pipewire.host_env", - return_value={"PIPEWIRE_PROPS": user_props}, - ), + patch.dict("os.environ", {"PIPEWIRE_PROPS": user_props}, clear=True), ): capture = PipeWireCaptureSource( device_index=PIPEWIRE_INDEX_BASE,