sintonia/analyzer/tests/playability_analyzer_test.py
Jonas L 30b3470a06
Better format enforcing (#1391)
* Add shared python format-check target

* Add .format-check to api lint target

* Format api code with makefile format target

* Add .format-check to tools lint target

* Add .format-check to analyzer lint target

* Format analyzer code with makefile format target

* Add .format-check to celery lint target

* Add .format-check to api_client lint target

* Format api_client code with makefile format target

* Add .format-check to playout lint target

* Run CI linting in parallel

* Disable isort in pre-commit
2021-10-17 16:24:37 +02:00

43 lines
1.1 KiB
Python

import distro
import pytest
from airtime_analyzer.playability_analyzer import (
PlayabilityAnalyzer,
UnplayableFileError,
)
from .fixtures import FILE_INVALID_DRM, FILES, Fixture
@pytest.mark.parametrize(
"filepath",
map(lambda i: str(i.path), FILES),
)
def test_analyze(filepath):
PlayabilityAnalyzer.analyze(filepath, dict())
def test_analyze_missing_liquidsoap():
old = PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE
PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE = "foobar"
PlayabilityAnalyzer.analyze(str(FILES[0].path), dict())
PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE = old
def test_analyze_invalid_filepath():
with pytest.raises(UnplayableFileError):
test_analyze("non-existent-file")
def test_analyze_invalid_wma():
# Liquisoap does not fail with wma files on debian buster
if "buster" == distro.codename():
return
with pytest.raises(UnplayableFileError):
test_analyze(FILE_INVALID_DRM)
def test_analyze_unknown():
with pytest.raises(UnplayableFileError):
test_analyze("https://www.google.com")