refactor(analyzer): improve analyzer pipeline module (#1542)
* rename steps to pipeline module * move pipeline entrypoint to pipeline module * rename steps test module to pipeline * fix paths after renames * move step protocol to pipeline * create pipeline status enum * use Protocol from typing extensions * Fix linting
This commit is contained in:
parent
74c8d20284
commit
cba905e367
18 changed files with 34 additions and 26 deletions
22
analyzer/tests/pipeline/analyze_replaygain_test.py
Normal file
22
analyzer/tests/pipeline/analyze_replaygain_test.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
import distro
|
||||
import pytest
|
||||
|
||||
from libretime_analyzer.pipeline.analyze_replaygain import analyze_replaygain
|
||||
|
||||
from ..fixtures import FILES
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"filepath,replaygain",
|
||||
map(lambda i: pytest.param(str(i.path), i.replaygain, id=i.path.name), FILES),
|
||||
)
|
||||
def test_analyze_replaygain(filepath, replaygain):
|
||||
tolerance = 0.8
|
||||
|
||||
# On bionic, replaygain is a bit higher for loud mp3 files.
|
||||
# This huge tolerance makes the test pass, with values devianting from ~-17 to ~-13
|
||||
if distro.codename() == "bionic" and str(filepath).endswith("+12.mp3"):
|
||||
tolerance = 5
|
||||
|
||||
metadata = analyze_replaygain(filepath, dict())
|
||||
assert metadata["replay_gain"] == pytest.approx(replaygain, abs=tolerance)
|
Loading…
Add table
Add a link
Reference in a new issue