mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 01:25:47 +01:00
fix update tests for mtime optimization (#227)
This commit is contained in:
parent
256cbf9fd5
commit
b1a1caa246
1 changed files with 17 additions and 1 deletions
|
|
@ -296,8 +296,11 @@ class UpdateTest(unittest.TestCase, _common.ExtraAsserts):
|
|||
self.io.restore()
|
||||
shutil.rmtree(self.libdir)
|
||||
|
||||
def _update(self, query=(), album=False, move=False):
|
||||
def _update(self, query=(), album=False, move=False, reset_mtime=True):
|
||||
self.io.addinput('y')
|
||||
if reset_mtime:
|
||||
self.i.mtime = 0
|
||||
self.lib.store(self.i)
|
||||
commands.update_items(self.lib, query, album, move, True, False)
|
||||
|
||||
def test_delete_removes_item(self):
|
||||
|
|
@ -360,6 +363,19 @@ class UpdateTest(unittest.TestCase, _common.ExtraAsserts):
|
|||
album = self.lib.albums()[0]
|
||||
self.assertNotEqual(artpath, album.artpath)
|
||||
|
||||
def test_mtime_match_skips_update(self):
|
||||
mf = MediaFile(self.i.path)
|
||||
mf.title = 'differentTitle'
|
||||
mf.save()
|
||||
|
||||
# Make in-memory mtime match on-disk mtime.
|
||||
self.i.mtime = os.path.getmtime(self.i.path)
|
||||
self.lib.store(self.i)
|
||||
|
||||
self._update(reset_mtime=False)
|
||||
item = self.lib.items().next()
|
||||
self.assertEqual(item.title, 'full')
|
||||
|
||||
class PrintTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.io = _common.DummyIO()
|
||||
|
|
|
|||
Loading…
Reference in a new issue