diff options
| author | historia <historiavg@proton.me> | 2026-09-11 17:41:33 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-09-11 17:41:33 -0400 |
| commit | 077c82d9614328ff267632298da6c88009313337 (patch) | |
| tree | 412f9e2d60c320e0c014eda45e76e36205b526ed /lib/project/tests | |
| parent | 84dd2d068317998f6fb59400c534ef5be6b51b53 (diff) | |
| download | producer-077c82d9614328ff267632298da6c88009313337.tar.gz | |
fix: consistently rename to producer
Diffstat (limited to 'lib/project/tests')
| -rw-r--r-- | lib/project/tests/conftest.py | 4 | ||||
| -rw-r--r-- | lib/project/tests/test_ai.py | 24 | ||||
| -rw-r--r-- | lib/project/tests/test_cli.py | 6 | ||||
| -rw-r--r-- | lib/project/tests/test_config.py | 12 | ||||
| -rw-r--r-- | lib/project/tests/test_install.py | 38 | ||||
| -rw-r--r-- | lib/project/tests/test_pipeline.py | 18 |
6 files changed, 51 insertions, 51 deletions
diff --git a/lib/project/tests/conftest.py b/lib/project/tests/conftest.py index 7c75358..0155384 100644 --- a/lib/project/tests/conftest.py +++ b/lib/project/tests/conftest.py @@ -8,8 +8,8 @@ import soundfile as sf # Support running the suite before the project is installed. sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src")) -from voiceforge.config import resolve -from voiceforge.setup import ensure_ffmpeg +from producer.config import resolve +from producer.setup import ensure_ffmpeg @pytest.fixture diff --git a/lib/project/tests/test_ai.py b/lib/project/tests/test_ai.py index e8c5872..8d08e5f 100644 --- a/lib/project/tests/test_ai.py +++ b/lib/project/tests/test_ai.py @@ -14,7 +14,7 @@ import numpy as np import pytest import soundfile as sf -from voiceforge import ai, ai_worker, setup +from producer import ai, ai_worker, setup MODEL_BYTES = 7986207 @@ -108,7 +108,7 @@ def test_subprocess_heartbeat_does_not_block_on_silence_or_closed_output(close_o def test_subprocess_parses_split_byte_progress_records(): events = [] - record = "VOICEFORGE_PROGRESS " + json.dumps(["Download (bytes)", 123, 456]) + "\n" + record = "PRODUCER_PROGRESS " + json.dumps(["Download (bytes)", 123, 456]) + "\n" code = f"import os,time; os.write(1,{record[:12].encode()!r}); time.sleep(.3); os.write(1,{record[12:].encode()!r})" setup.run_process([sys.executable, "-c", code], "Download", lambda *event: events.append(event)) assert events[-1] == ("Download (bytes)", 123, 456) @@ -203,14 +203,14 @@ def _ready_environment(root, flavor="cpu"): environment = root / f"ai-df-0.5.6-torch-2.5.1-{flavor}-py311-v1" (environment / "bin").mkdir(parents=True) (environment / "bin/python").write_text("#!/bin/sh\n") - (environment / ".voiceforge-ready").touch() + (environment / ".producer-ready").touch() return environment def test_ready_environment_skips_the_check_worker(tmp_path, monkeypatch): root = tmp_path / "prefix" environment = _ready_environment(root) - monkeypatch.setenv("VOICEFORGE_HOME", str(root)) + monkeypatch.setenv("PRODUCER_HOME", str(root)) monkeypatch.setattr(ai.os, "confstr", lambda *_: "glibc 2.39") executed = [] monkeypatch.setattr(ai, "run_process", lambda args, *rest, **kwargs: executed.append(args)) @@ -222,7 +222,7 @@ def test_ready_environment_skips_the_check_worker(tmp_path, monkeypatch): def test_setup_verifies_even_a_ready_environment(tmp_path, monkeypatch): root = tmp_path / "prefix" _ready_environment(root) - monkeypatch.setenv("VOICEFORGE_HOME", str(root)) + monkeypatch.setenv("PRODUCER_HOME", str(root)) monkeypatch.setattr(ai.os, "confstr", lambda *_: "glibc 2.39") executed = [] monkeypatch.setattr(ai, "run_process", lambda args, *rest, **kwargs: executed.append(args)) @@ -238,7 +238,7 @@ def test_broken_environment_is_rebuilt_and_self_tested(tmp_path, monkeypatch): (environment / "bin/python").symlink_to("/nonexistent/python3.11") leftover = environment / "leftover.txt" leftover.write_text("from the previous location") - monkeypatch.setenv("VOICEFORGE_HOME", str(root)) + monkeypatch.setenv("PRODUCER_HOME", str(root)) monkeypatch.setattr(ai.os, "confstr", lambda *_: "glibc 2.39") stages, commands = [], [] @@ -247,7 +247,7 @@ def test_broken_environment_is_rebuilt_and_self_tested(tmp_path, monkeypatch): stages.append(stage) if stage == "Checking DeepFilterNet3": environment.mkdir(parents=True, exist_ok=True) - (environment / ".voiceforge-ready").touch() + (environment / ".producer-ready").touch() monkeypatch.setattr(ai, "run_process", fake_run) monkeypatch.setattr(ai, "ensure_uv", lambda progress=None: "uv") @@ -256,7 +256,7 @@ def test_broken_environment_is_rebuilt_and_self_tested(tmp_path, monkeypatch): assert stages == ["Preparing AI Python 3.11", "Installing PyTorch (cpu)", "Installing DeepFilterNet3", "Checking DeepFilterNet3"] assert commands[0][-1] == str(environment) - assert (environment / ".voiceforge-ready").is_file() + assert (environment / ".producer-ready").is_file() def test_copied_environment_is_rebuilt_not_trusted(tmp_path, monkeypatch): @@ -268,7 +268,7 @@ def test_copied_environment_is_rebuilt_not_trusted(tmp_path, monkeypatch): original = _ready_environment(tmp_path / "other") (environment / "bin/python").unlink() (environment / "bin/python").symlink_to(original / "bin/python") - monkeypatch.setenv("VOICEFORGE_HOME", str(root)) + monkeypatch.setenv("PRODUCER_HOME", str(root)) monkeypatch.setattr(ai.os, "confstr", lambda *_: "glibc 2.39") stages = [] @@ -276,7 +276,7 @@ def test_copied_environment_is_rebuilt_not_trusted(tmp_path, monkeypatch): stages.append(stage) if stage == "Checking DeepFilterNet3": environment.mkdir(parents=True, exist_ok=True) - (environment / ".voiceforge-ready").touch() + (environment / ".producer-ready").touch() monkeypatch.setattr(ai, "run_process", fake_run) monkeypatch.setattr(ai, "ensure_uv", lambda progress=None: "uv") @@ -351,7 +351,7 @@ def test_mocked_worker_exact_length_mix_and_bounded_windows(tmp_path, wav, mocke assert calls == [] assert max(calls, default=0) <= 674400 assert progress.call_args.args == ("Denoising (cpu)", frames, frames) - assert not list(tmp_path.glob(".voiceforge-ai-*")) + assert not list(tmp_path.glob(".producer-ai-*")) def test_worker_failure_preserves_existing_target(tmp_path, wav, mocked_worker): @@ -363,4 +363,4 @@ def test_worker_failure_preserves_existing_target(tmp_path, wav, mocked_worker): with pytest.raises(RuntimeError, match="inference failed"): run(source, target, 0.85) assert target.read_bytes() == b"existing output" - assert not list(tmp_path.glob(".voiceforge-ai-*")) + assert not list(tmp_path.glob(".producer-ai-*")) diff --git a/lib/project/tests/test_cli.py b/lib/project/tests/test_cli.py index a5437b7..300b3a8 100644 --- a/lib/project/tests/test_cli.py +++ b/lib/project/tests/test_cli.py @@ -6,13 +6,13 @@ import numpy as np import pytest import soundfile as sf -from voiceforge import cli, pipeline +from producer import cli, pipeline @pytest.fixture def invoke(monkeypatch): def run(*args): - monkeypatch.setattr(sys, "argv", ["voiceforge", *map(str, args)]) + monkeypatch.setattr(sys, "argv", ["producer", *map(str, args)]) return cli.main() return run @@ -54,7 +54,7 @@ def test_preview_real_audio_preserves_original_and_reports_provenance( info = sf.info(target) assert info.duration == pytest.approx(5, abs=0.02) assert info.channels == 1 - assert info.subtype == "PCM_24" + assert info.subtype == "PCM_32" assert report["output"] == str(target) assert report["provenance"] == { "original": str(source.resolve()), "preview_start_seconds": 1, diff --git a/lib/project/tests/test_config.py b/lib/project/tests/test_config.py index 8144fc8..d3321d5 100644 --- a/lib/project/tests/test_config.py +++ b/lib/project/tests/test_config.py @@ -2,9 +2,9 @@ from dataclasses import asdict, fields import pytest -from voiceforge.cli import main, parser, settings_for -from voiceforge.config import PROFILES, RANGES, Settings, resolve, toml -from voiceforge.pipeline import filters +from producer.cli import main, parser, settings_for +from producer.config import PROFILES, RANGES, Settings, resolve, toml +from producer.pipeline import filters @pytest.mark.parametrize("profile", PROFILES) @@ -97,9 +97,9 @@ def test_invalid_cli_configuration_fails_before_processing(monkeypatch, capsys): def unexpected(*args, **kwargs): pytest.fail("Invalid configuration must not reach processing or tool setup") - monkeypatch.setattr("voiceforge.cli.process", unexpected) - monkeypatch.setattr("voiceforge.cli.ensure_ffmpeg", unexpected) - monkeypatch.setattr("sys.argv", ["voiceforge", "process", "missing.wav", "--target-lufs", "0"]) + monkeypatch.setattr("producer.cli.process", unexpected) + monkeypatch.setattr("producer.cli.ensure_ffmpeg", unexpected) + monkeypatch.setattr("sys.argv", ["producer", "process", "missing.wav", "--target-lufs", "0"]) with pytest.raises(SystemExit) as error: main() assert error.value.code == 1 diff --git a/lib/project/tests/test_install.py b/lib/project/tests/test_install.py index f1dfcf2..a137cf1 100644 --- a/lib/project/tests/test_install.py +++ b/lib/project/tests/test_install.py @@ -7,7 +7,7 @@ import types import pytest -from voiceforge import setup +from producer import setup ROOT = Path(__file__).resolve().parents[3] LAUNCHER = ROOT / "producer.sh" @@ -16,7 +16,7 @@ LAUNCHER = ROOT / "producer.sh" @pytest.fixture def shell_env(tmp_path): env = os.environ.copy() - env.pop("VOICEFORGE_HOME", None) + env.pop("PRODUCER_HOME", None) env.pop("XDG_DATA_HOME", None) env["HOME"] = str(tmp_path / "home") return env @@ -25,33 +25,33 @@ def shell_env(tmp_path): # --- data_dir resolution --------------------------------------------------- def test_data_dir_defaults_and_precedence(tmp_path, monkeypatch): - monkeypatch.delenv("VOICEFORGE_HOME", raising=False) + monkeypatch.delenv("PRODUCER_HOME", raising=False) monkeypatch.delenv("XDG_DATA_HOME", raising=False) monkeypatch.setenv("HOME", str(tmp_path)) - assert setup.data_dir() == tmp_path / ".local/share/voiceforge" + assert setup.data_dir() == tmp_path / ".local/share/producer" monkeypatch.setenv("XDG_DATA_HOME", str(tmp_path / "xdg")) - assert setup.data_dir() == tmp_path / "xdg/voiceforge" - monkeypatch.setenv("VOICEFORGE_HOME", str(tmp_path / "prefix")) + assert setup.data_dir() == tmp_path / "xdg/producer" + monkeypatch.setenv("PRODUCER_HOME", str(tmp_path / "prefix")) assert setup.data_dir() == tmp_path / "prefix" -def test_relative_voiceforge_home_resolves_against_cwd(tmp_path, monkeypatch): - monkeypatch.setenv("VOICEFORGE_HOME", "voiceforge-home") +def test_relative_producer_home_resolves_against_cwd(tmp_path, monkeypatch): + monkeypatch.setenv("PRODUCER_HOME", "producer-home") monkeypatch.chdir(tmp_path) - assert setup.data_dir() == tmp_path / "voiceforge-home" + assert setup.data_dir() == tmp_path / "producer-home" def test_relative_xdg_data_home_falls_back_to_home(tmp_path, monkeypatch): - monkeypatch.delenv("VOICEFORGE_HOME", raising=False) + monkeypatch.delenv("PRODUCER_HOME", raising=False) monkeypatch.setenv("HOME", str(tmp_path)) monkeypatch.setenv("XDG_DATA_HOME", "relative/path") - assert setup.data_dir() == tmp_path / ".local/share/voiceforge" + assert setup.data_dir() == tmp_path / ".local/share/producer" # --- contained tool environment -------------------------------------------- def test_tool_env_is_sanitized_and_contained(tmp_path, monkeypatch): - monkeypatch.setenv("VOICEFORGE_HOME", str(tmp_path / "prefix")) + monkeypatch.setenv("PRODUCER_HOME", str(tmp_path / "prefix")) monkeypatch.setenv("PYTHONPATH", "/host/site-packages") monkeypatch.setenv("PYTHONHOME", "/host/python") monkeypatch.setenv("VIRTUAL_ENV", "/host/venv") @@ -89,21 +89,21 @@ def test_tool_env_is_sanitized_and_contained(tmp_path, monkeypatch): def test_tool_env_tolerates_an_uncreatable_data_dir(monkeypatch): - monkeypatch.setenv("VOICEFORGE_HOME", "/vf-prefix-unwritable") + monkeypatch.setenv("PRODUCER_HOME", "/vf-prefix-unwritable") env = setup.tool_env() assert env["PIP_CACHE_DIR"] == "/vf-prefix-unwritable/cache/pip" assert "TMPDIR" not in env def test_tool_env_leaves_process_environment_untouched(tmp_path, monkeypatch): - monkeypatch.setenv("VOICEFORGE_HOME", str(tmp_path / "prefix")) + monkeypatch.setenv("PRODUCER_HOME", str(tmp_path / "prefix")) monkeypatch.setenv("PYTHONPATH", "/host/site-packages") setup.tool_env() assert os.environ["PYTHONPATH"] == "/host/site-packages" def test_ensure_uv_bootstraps_into_data_dir_with_contained_pip_cache(tmp_path, monkeypatch): - monkeypatch.setenv("VOICEFORGE_HOME", str(tmp_path / "prefix")) + monkeypatch.setenv("PRODUCER_HOME", str(tmp_path / "prefix")) monkeypatch.setattr(setup.shutil, "which", lambda name: None) calls = [] uv_binary = tmp_path / "prefix/bootstrap/bin/uv" @@ -130,7 +130,7 @@ def test_ensure_uv_bootstraps_into_data_dir_with_contained_pip_cache(tmp_path, m def test_ensure_uv_reuses_contained_bootstrap(tmp_path, monkeypatch): - monkeypatch.setenv("VOICEFORGE_HOME", str(tmp_path / "prefix")) + monkeypatch.setenv("PRODUCER_HOME", str(tmp_path / "prefix")) uv_binary = tmp_path / "prefix/bootstrap/bin/uv" uv_binary.parent.mkdir(parents=True) uv_binary.write_text("#!/bin/sh\n") @@ -140,7 +140,7 @@ def test_ensure_uv_reuses_contained_bootstrap(tmp_path, monkeypatch): def test_ensure_uv_prefers_the_contained_bootstrap_over_a_host_uv(tmp_path, monkeypatch): - monkeypatch.setenv("VOICEFORGE_HOME", str(tmp_path / "prefix")) + monkeypatch.setenv("PRODUCER_HOME", str(tmp_path / "prefix")) uv_binary = tmp_path / "prefix/bootstrap/bin/uv" uv_binary.parent.mkdir(parents=True) uv_binary.write_text("#!/bin/sh\n") @@ -150,7 +150,7 @@ def test_ensure_uv_prefers_the_contained_bootstrap_over_a_host_uv(tmp_path, monk def test_ensure_uv_ignores_a_host_uv_without_required_capability(tmp_path, monkeypatch): - monkeypatch.setenv("VOICEFORGE_HOME", str(tmp_path / "prefix")) + monkeypatch.setenv("PRODUCER_HOME", str(tmp_path / "prefix")) monkeypatch.setattr(setup.shutil, "which", lambda name: "/host/bin/uv") monkeypatch.setattr(setup, "_uv_supports_relocatable", lambda uv: False) stages = [] @@ -169,7 +169,7 @@ def test_ensure_uv_ignores_a_host_uv_without_required_capability(tmp_path, monke def test_ensure_uv_fails_when_bootstrap_does_not_produce_uv(tmp_path, monkeypatch): - monkeypatch.setenv("VOICEFORGE_HOME", str(tmp_path / "prefix")) + monkeypatch.setenv("PRODUCER_HOME", str(tmp_path / "prefix")) monkeypatch.setattr(setup.shutil, "which", lambda name: None) monkeypatch.setattr(setup, "run_process", lambda *args, **kwargs: None) with pytest.raises(RuntimeError, match="did not produce a usable uv"): diff --git a/lib/project/tests/test_pipeline.py b/lib/project/tests/test_pipeline.py index 0fa1c52..3f6000d 100644 --- a/lib/project/tests/test_pipeline.py +++ b/lib/project/tests/test_pipeline.py @@ -4,9 +4,9 @@ import numpy as np import pytest import soundfile as sf -from voiceforge import pipeline -from voiceforge.audio import loudness, measure -from voiceforge.config import resolve +from producer import pipeline +from producer.audio import loudness, measure +from producer.config import resolve @pytest.mark.parametrize("kind", ["missing", "input-extension", "output-extension"]) @@ -103,7 +103,7 @@ def test_explicit_stereo_selection_preserves_signal_and_duration(wav, tmp_path, np.testing.assert_allclose(actual, expected, atol=5e-7, rtol=0) assert report["normalization_mode"] == "disabled" assert report["level_correction_db"] == 0 - assert sf.info(target).subtype == "PCM_24" + assert sf.info(target).subtype == "PCM_32" @pytest.mark.parametrize("rate", [44100, 48000]) @@ -116,7 +116,7 @@ def test_normalization_peak_ceiling_and_report(wav, tmp_path, progress, ffmpeg, stats = sf.info(target) assert stats.channels == 1 assert stats.samplerate == rate - assert stats.subtype == "PCM_24" + assert stats.subtype == "PCM_32" assert abs(stats.duration - 3) <= 0.02 verified = loudness(ffmpeg, target, settings, stats.duration, progress) assert verified["input_i"] == pytest.approx(settings.target_lufs, abs=0.5) @@ -125,7 +125,7 @@ def test_normalization_peak_ceiling_and_report(wav, tmp_path, progress, ffmpeg, assert report["master"]["sample_peak_dbfs"] <= settings.true_peak_db + 0.1 assert json.loads(target.with_suffix(".report.json").read_text()) == report assert source.read_bytes() == original - assert not list(target.parent.glob(".voiceforge-*")) + assert not list(target.parent.glob(".producer-*")) def test_limiter_without_normalization(wav, tmp_path, bypass, progress, ffmpeg): @@ -183,7 +183,7 @@ def test_antiphase_mix_is_rejected_after_selection(wav, tmp_path, bypass, progre pipeline.process(source, target, bypass, progress) assert not target.exists() assert not target.with_suffix(".report.json").exists() - assert not list(tmp_path.glob(".voiceforge-*")) + assert not list(tmp_path.glob(".producer-*")) def test_silent_selected_channel_is_rejected_after_selection(wav, tmp_path, bypass, progress, ffmpeg): @@ -201,7 +201,7 @@ def test_zero_denoise_strength_skips_ai(wav, tmp_path, bypass, progress, ffmpeg, def unexpected(*args, **kwargs): pytest.fail("Zero denoise strength must not invoke AI") - monkeypatch.setattr("voiceforge.ai.denoise", unexpected) + monkeypatch.setattr("producer.ai.denoise", unexpected) bypass.denoiser = "deepfilter" bypass.denoise_strength = 0 report = pipeline.process(wav(), tmp_path / "master.wav", bypass, progress) @@ -244,7 +244,7 @@ def test_render_failure_preserves_existing_outputs_and_removes_temporary_files(w with pytest.raises(RuntimeError, match="injected encoder failure"): pipeline.process(source, target, bypass, progress, overwrite=True) assert all(path.read_bytes() == b"previous publication" for path in outputs) - assert not list(tmp_path.glob(".voiceforge-*")) + assert not list(tmp_path.glob(".producer-*")) @pytest.mark.parametrize("overwrite", [False, True]) |
