Fix tests naming
This commit is contained in:
parent
d94193ce57
commit
9639010ba6
5 changed files with 17 additions and 17 deletions
|
@ -9,7 +9,7 @@ from airtime_analyzer.analyzer_pipeline import AnalyzerPipeline
|
||||||
from .conftest import AUDIO_FILENAME, AUDIO_IMPORT_DEST
|
from .conftest import AUDIO_FILENAME, AUDIO_IMPORT_DEST
|
||||||
|
|
||||||
|
|
||||||
def test_basic(src_dir, dest_dir):
|
def test_run_analysis(src_dir, dest_dir):
|
||||||
queue = Queue()
|
queue = Queue()
|
||||||
AnalyzerPipeline.run_analysis(
|
AnalyzerPipeline.run_analysis(
|
||||||
queue,
|
queue,
|
||||||
|
|
|
@ -30,18 +30,18 @@ def test_analyze(filepath):
|
||||||
assert abs(float(metadata["cueout"]) - length_seconds) < tolerance_seconds
|
assert abs(float(metadata["cueout"]) - length_seconds) < tolerance_seconds
|
||||||
|
|
||||||
|
|
||||||
def test_missing_silan():
|
def test_analyze_missing_silan():
|
||||||
old = CuePointAnalyzer.SILAN_EXECUTABLE
|
old = CuePointAnalyzer.SILAN_EXECUTABLE
|
||||||
CuePointAnalyzer.SILAN_EXECUTABLE = "foobar"
|
CuePointAnalyzer.SILAN_EXECUTABLE = "foobar"
|
||||||
CuePointAnalyzer.analyze("tests/test_data/44100Hz-16bit-mono.mp3", dict())
|
CuePointAnalyzer.analyze("tests/test_data/44100Hz-16bit-mono.mp3", dict())
|
||||||
CuePointAnalyzer.SILAN_EXECUTABLE = old
|
CuePointAnalyzer.SILAN_EXECUTABLE = old
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_filepath():
|
def test_analyze_invalid_filepath():
|
||||||
with pytest.raises(KeyError):
|
with pytest.raises(KeyError):
|
||||||
test_analyze("non-existent-file")
|
test_analyze("non-existent-file")
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_wma():
|
def test_analyze_invalid_wma():
|
||||||
with pytest.raises(KeyError):
|
with pytest.raises(KeyError):
|
||||||
test_analyze("tests/test_data/44100Hz-16bit-stereo-invalid.wma")
|
test_analyze("tests/test_data/44100Hz-16bit-stereo-invalid.wma")
|
||||||
|
|
|
@ -9,7 +9,7 @@ from airtime_analyzer.filemover_analyzer import FileMoverAnalyzer
|
||||||
from .conftest import AUDIO_FILENAME
|
from .conftest import AUDIO_FILENAME
|
||||||
|
|
||||||
|
|
||||||
def test_dont_use_analyze():
|
def test_analyze():
|
||||||
with pytest.raises(Exception):
|
with pytest.raises(Exception):
|
||||||
FileMoverAnalyzer.analyze("foo", dict())
|
FileMoverAnalyzer.analyze("foo", dict())
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ def test_move_wrong_params(params, exception):
|
||||||
FileMoverAnalyzer.move(*params)
|
FileMoverAnalyzer.move(*params)
|
||||||
|
|
||||||
|
|
||||||
def test_basic(src_dir, dest_dir):
|
def test_move(src_dir, dest_dir):
|
||||||
FileMoverAnalyzer.move(
|
FileMoverAnalyzer.move(
|
||||||
os.path.join(src_dir, AUDIO_FILENAME),
|
os.path.join(src_dir, AUDIO_FILENAME),
|
||||||
dest_dir,
|
dest_dir,
|
||||||
|
@ -38,7 +38,7 @@ def test_basic(src_dir, dest_dir):
|
||||||
assert os.path.exists(os.path.join(dest_dir, AUDIO_FILENAME))
|
assert os.path.exists(os.path.join(dest_dir, AUDIO_FILENAME))
|
||||||
|
|
||||||
|
|
||||||
def test_basic_samefile(src_dir):
|
def test_move_samefile(src_dir):
|
||||||
FileMoverAnalyzer.move(
|
FileMoverAnalyzer.move(
|
||||||
os.path.join(src_dir, AUDIO_FILENAME),
|
os.path.join(src_dir, AUDIO_FILENAME),
|
||||||
src_dir,
|
src_dir,
|
||||||
|
@ -70,7 +70,7 @@ def import_and_restore(src_dir, dest_dir) -> dict:
|
||||||
return metadata
|
return metadata
|
||||||
|
|
||||||
|
|
||||||
def test_duplicate_file(src_dir, dest_dir):
|
def test_move_duplicate_file(src_dir, dest_dir):
|
||||||
# Import the file once
|
# Import the file once
|
||||||
import_and_restore(src_dir, dest_dir)
|
import_and_restore(src_dir, dest_dir)
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ def test_duplicate_file(src_dir, dest_dir):
|
||||||
assert os.path.exists(os.path.join(dest_dir, AUDIO_FILENAME))
|
assert os.path.exists(os.path.join(dest_dir, AUDIO_FILENAME))
|
||||||
|
|
||||||
|
|
||||||
def test_double_duplicate_files(src_dir, dest_dir):
|
def test_move_triplicate_file(src_dir, dest_dir):
|
||||||
# Here we use mock to patch out the time.localtime() function so that it
|
# 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
|
# 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.
|
# where the last two of the three files are imported at the same time as the timestamp.
|
||||||
|
@ -108,7 +108,7 @@ def test_double_duplicate_files(src_dir, dest_dir):
|
||||||
assert len(os.path.basename(metadata2["full_path"]).split("_")) == 3
|
assert len(os.path.basename(metadata2["full_path"]).split("_")) == 3
|
||||||
|
|
||||||
|
|
||||||
def test_bad_permissions_destination_dir(src_dir):
|
def test_move_bad_permissions_dest_dir(src_dir):
|
||||||
with pytest.raises(OSError):
|
with pytest.raises(OSError):
|
||||||
# /sys is using sysfs on Linux, which is unwritable
|
# /sys is using sysfs on Linux, which is unwritable
|
||||||
FileMoverAnalyzer.move(
|
FileMoverAnalyzer.move(
|
||||||
|
|
|
@ -26,23 +26,23 @@ def test_analyze(filepath):
|
||||||
PlayabilityAnalyzer.analyze(filepath, dict())
|
PlayabilityAnalyzer.analyze(filepath, dict())
|
||||||
|
|
||||||
|
|
||||||
def test_missing_liquidsoap():
|
def test_analyze_missing_liquidsoap():
|
||||||
old = PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE
|
old = PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE
|
||||||
PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE = "foobar"
|
PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE = "foobar"
|
||||||
PlayabilityAnalyzer.analyze("tests/test_data/44100Hz-16bit-mono.mp3", dict())
|
PlayabilityAnalyzer.analyze("tests/test_data/44100Hz-16bit-mono.mp3", dict())
|
||||||
PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE = old
|
PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE = old
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_filepath():
|
def test_analyze_invalid_filepath():
|
||||||
with pytest.raises(UnplayableFileError):
|
with pytest.raises(UnplayableFileError):
|
||||||
test_analyze("non-existent-file")
|
test_analyze("non-existent-file")
|
||||||
|
|
||||||
|
|
||||||
# def test_invalid_wma():
|
# def test_analyze_invalid_wma():
|
||||||
# with pytest.raises(UnplayableFileError):
|
# with pytest.raises(UnplayableFileError):
|
||||||
# test_analyze("tests/test_data/44100Hz-16bit-stereo-invalid.wma")
|
# test_analyze("tests/test_data/44100Hz-16bit-stereo-invalid.wma")
|
||||||
|
|
||||||
|
|
||||||
def test_unknown():
|
def test_analyze_unknown():
|
||||||
with pytest.raises(UnplayableFileError):
|
with pytest.raises(UnplayableFileError):
|
||||||
test_analyze("https://www.google.com")
|
test_analyze("https://www.google.com")
|
||||||
|
|
|
@ -28,18 +28,18 @@ def test_analyze(filepath):
|
||||||
assert abs(metadata["replay_gain"] - expected_replaygain) < tolerance
|
assert abs(metadata["replay_gain"] - expected_replaygain) < tolerance
|
||||||
|
|
||||||
|
|
||||||
def test_missing_replaygain():
|
def test_analyze_missing_replaygain():
|
||||||
old = ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE
|
old = ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE
|
||||||
ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = "foobar"
|
ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = "foobar"
|
||||||
ReplayGainAnalyzer.analyze("tests/test_data/44100Hz-16bit-mono.mp3", dict())
|
ReplayGainAnalyzer.analyze("tests/test_data/44100Hz-16bit-mono.mp3", dict())
|
||||||
ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = old
|
ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = old
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_filepath():
|
def test_analyze_invalid_filepath():
|
||||||
with pytest.raises(KeyError):
|
with pytest.raises(KeyError):
|
||||||
test_analyze("non-existent-file")
|
test_analyze("non-existent-file")
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_wma():
|
def test_analyze_invalid_wma():
|
||||||
with pytest.raises(KeyError):
|
with pytest.raises(KeyError):
|
||||||
test_analyze("tests/test_data/44100Hz-16bit-stereo-invalid.wma")
|
test_analyze("tests/test_data/44100Hz-16bit-stereo-invalid.wma")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue