Improve test to not sleep

This commit is contained in:
Eric Masseran 2025-11-10 23:44:02 +01:00
parent 95f21b6e42
commit d11c074a85

View file

@ -17,7 +17,6 @@ import os
import os.path
import shutil
import tempfile
import time
import unittest
from unittest.mock import MagicMock, patch
@ -229,21 +228,19 @@ class EmbedartCliTest(
item = album.items()[0]
self.io.addinput("y")
self.run_command("embedart", "-f", self.small_artpath)
embedded_time = item.current_mtime()
time.sleep(1)
embedded_time = os.path.getmtime(syspath(item.path))
self.io.addinput("y")
self.run_command("clearart")
mediafile = MediaFile(syspath(item.path))
assert not mediafile.images
clear_time = item.current_mtime()
clear_time = os.path.getmtime(syspath(item.path))
assert clear_time > embedded_time
time.sleep(1)
# A run on a file without an image should not be modified
self.io.addinput("y")
self.run_command("clearart")
no_clear_time = item.current_mtime()
no_clear_time = os.path.getmtime(syspath(item.path))
assert no_clear_time == clear_time
def test_clear_art_with_no_input(self):