Skip to content

Commit 05576cd

Browse files
committed
fix tests with unclean files, fixes #290
1 parent b67c638 commit 05576cd

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -477,13 +477,22 @@ def test_audio_channels(self):
477477
assert stream_info["channels"] == 2
478478

479479
def test_replaygain(self):
480-
for file in [
480+
REPLAYGAIN_FILES = [
481481
"tests/test.mp4",
482482
"tests/test.mp3",
483483
"tests/test.ogg",
484484
"tests/test.opus",
485-
]:
486-
original_mtime = os.path.getmtime(file)
487-
ffmpeg_normalize_call([file, "--replaygain"])
488-
assert os.path.isfile(file)
489-
assert os.path.getmtime(file) > original_mtime
485+
]
486+
try:
487+
for file in REPLAYGAIN_FILES:
488+
original_mtime = os.path.getmtime(file)
489+
ffmpeg_normalize_call([file, "--replaygain"])
490+
assert os.path.isfile(file)
491+
assert os.path.getmtime(file) > original_mtime
492+
except AssertionError:
493+
print(f"Failed to normalize {file}")
494+
raise
495+
finally:
496+
# git checkout the files!
497+
for file in REPLAYGAIN_FILES:
498+
subprocess.run(["git", "checkout", file], check=False)

0 commit comments

Comments
 (0)