Fix tests naming

This commit is contained in:
jo 2021-05-29 18:39:10 +02:00
parent d94193ce57
commit 9639010ba6
5 changed files with 17 additions and 17 deletions

View file

@ -9,7 +9,7 @@ from airtime_analyzer.analyzer_pipeline import AnalyzerPipeline
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()
AnalyzerPipeline.run_analysis(
queue,

View file

@ -30,18 +30,18 @@ def test_analyze(filepath):
assert abs(float(metadata["cueout"]) - length_seconds) < tolerance_seconds
def test_missing_silan():
def test_analyze_missing_silan():
old = CuePointAnalyzer.SILAN_EXECUTABLE
CuePointAnalyzer.SILAN_EXECUTABLE = "foobar"
CuePointAnalyzer.analyze("tests/test_data/44100Hz-16bit-mono.mp3", dict())
CuePointAnalyzer.SILAN_EXECUTABLE = old
def test_invalid_filepath():
def test_analyze_invalid_filepath():
with pytest.raises(KeyError):
test_analyze("non-existent-file")
def test_invalid_wma():
def test_analyze_invalid_wma():
with pytest.raises(KeyError):
test_analyze("tests/test_data/44100Hz-16bit-stereo-invalid.wma")

View file

@ -9,7 +9,7 @@ from airtime_analyzer.filemover_analyzer import FileMoverAnalyzer
from .conftest import AUDIO_FILENAME
def test_dont_use_analyze():
def test_analyze():
with pytest.raises(Exception):
FileMoverAnalyzer.analyze("foo", dict())
@ -28,7 +28,7 @@ def test_move_wrong_params(params, exception):
FileMoverAnalyzer.move(*params)
def test_basic(src_dir, dest_dir):
def test_move(src_dir, dest_dir):
FileMoverAnalyzer.move(
os.path.join(src_dir, AUDIO_FILENAME),
dest_dir,
@ -38,7 +38,7 @@ def test_basic(src_dir, dest_dir):
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(
os.path.join(src_dir, AUDIO_FILENAME),
src_dir,
@ -70,7 +70,7 @@ def import_and_restore(src_dir, dest_dir) -> dict:
return metadata
def test_duplicate_file(src_dir, dest_dir):
def test_move_duplicate_file(src_dir, dest_dir):
# Import the file once
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))
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
# 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.
@ -108,7 +108,7 @@ def test_double_duplicate_files(src_dir, dest_dir):
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):
# /sys is using sysfs on Linux, which is unwritable
FileMoverAnalyzer.move(

View file

@ -26,23 +26,23 @@ def test_analyze(filepath):
PlayabilityAnalyzer.analyze(filepath, dict())
def test_missing_liquidsoap():
def test_analyze_missing_liquidsoap():
old = PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE
PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE = "foobar"
PlayabilityAnalyzer.analyze("tests/test_data/44100Hz-16bit-mono.mp3", dict())
PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE = old
def test_invalid_filepath():
def test_analyze_invalid_filepath():
with pytest.raises(UnplayableFileError):
test_analyze("non-existent-file")
# def test_invalid_wma():
# def test_analyze_invalid_wma():
# with pytest.raises(UnplayableFileError):
# test_analyze("tests/test_data/44100Hz-16bit-stereo-invalid.wma")
def test_unknown():
def test_analyze_unknown():
with pytest.raises(UnplayableFileError):
test_analyze("https://www.google.com")

View file

@ -28,18 +28,18 @@ def test_analyze(filepath):
assert abs(metadata["replay_gain"] - expected_replaygain) < tolerance
def test_missing_replaygain():
def test_analyze_missing_replaygain():
old = ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE
ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = "foobar"
ReplayGainAnalyzer.analyze("tests/test_data/44100Hz-16bit-mono.mp3", dict())
ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = old
def test_invalid_filepath():
def test_analyze_invalid_filepath():
with pytest.raises(KeyError):
test_analyze("non-existent-file")
def test_invalid_wma():
def test_analyze_invalid_wma():
with pytest.raises(KeyError):
test_analyze("tests/test_data/44100Hz-16bit-stereo-invalid.wma")