sintonia/analyzer/tests/pipeline/analyze_playability_test.py
Jonas L cba905e367
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
2022-01-28 07:09:19 +02:00

46 lines
1.2 KiB
Python

from unittest.mock import patch
import distro
import pytest
from libretime_analyzer.pipeline.analyze_playability import (
UnplayableFileError,
analyze_playability,
)
from ..fixtures import FILE_INVALID_DRM, FILES
@pytest.mark.parametrize(
"filepath",
map(lambda i: str(i.path), FILES),
)
def test_analyze_playability(filepath):
analyze_playability(filepath, dict())
def test_analyze_playability_missing_liquidsoap():
with patch(
"libretime_analyzer.pipeline.analyze_playability.LIQUIDSOAP_EXECUTABLE",
"foobar",
):
analyze_playability(str(FILES[0].path), dict())
def test_analyze_playability_invalid_filepath():
with pytest.raises(UnplayableFileError):
test_analyze_playability("non-existent-file")
def test_analyze_playability_invalid_wma():
# Liquisoap does not fail with wma files on buster, bullseye, focal
if distro.codename() in ("buster", "bullseye", "focal"):
return
with pytest.raises(UnplayableFileError):
test_analyze_playability(FILE_INVALID_DRM)
def test_analyze_playability_unknown():
with pytest.raises(UnplayableFileError):
test_analyze_playability("https://www.google.com")