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:
Jonas L 2022-01-28 06:09:19 +01:00 committed by GitHub
parent 74c8d20284
commit cba905e367
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 34 additions and 26 deletions

View file

@ -1,6 +1,6 @@
import pytest
from libretime_analyzer.steps.analyze_cuepoint import analyze_cuepoint
from libretime_analyzer.pipeline.analyze_cuepoint import analyze_cuepoint
from ..fixtures import FILES

View file

@ -1,6 +1,6 @@
import pytest
from libretime_analyzer.steps.analyze_metadata import analyze_metadata
from libretime_analyzer.pipeline.analyze_metadata import analyze_metadata
from ..fixtures import FILE_INVALID_DRM, FILE_INVALID_TXT, FILES_TAGGED

View file

@ -3,7 +3,7 @@ from unittest.mock import patch
import distro
import pytest
from libretime_analyzer.steps.analyze_playability import (
from libretime_analyzer.pipeline.analyze_playability import (
UnplayableFileError,
analyze_playability,
)
@ -21,7 +21,7 @@ def test_analyze_playability(filepath):
def test_analyze_playability_missing_liquidsoap():
with patch(
"libretime_analyzer.steps.analyze_playability.LIQUIDSOAP_EXECUTABLE",
"libretime_analyzer.pipeline.analyze_playability.LIQUIDSOAP_EXECUTABLE",
"foobar",
):
analyze_playability(str(FILES[0].path), dict())

View file

@ -1,7 +1,7 @@
import distro
import pytest
from libretime_analyzer.steps.analyze_replaygain import analyze_replaygain
from libretime_analyzer.pipeline.analyze_replaygain import analyze_replaygain
from ..fixtures import FILES

View file

@ -5,7 +5,7 @@ from unittest import mock
import pytest
from libretime_analyzer.steps.organise_file import organise_file
from libretime_analyzer.pipeline.organise_file import organise_file
from ..conftest import AUDIO_FILENAME
@ -82,7 +82,7 @@ def test_organise_file_triplicate_file(src_dir, dest_dir):
# Here we use mock to patch out the time.localtime() function so that it
# always returns the same value. This allows us to consistently simulate this test cases
# where the last two of the three files are imported at the same time as the timestamp.
with mock.patch("libretime_analyzer.steps.organise_file.time") as mock_time:
with mock.patch("libretime_analyzer.pipeline.organise_file.time") as mock_time:
mock_time.localtime.return_value = time.localtime() # date(2010, 10, 8)
mock_time.side_effect = time.time

View file

@ -6,7 +6,7 @@ import pytest
from libretime_analyzer.pipeline import Pipeline
from .conftest import AUDIO_FILENAME, AUDIO_IMPORT_DEST
from ..conftest import AUDIO_FILENAME, AUDIO_IMPORT_DEST
def test_run_analysis(src_dir, dest_dir):