diff --git a/test/test_ui.py b/test/test_ui.py index 155af8802..17d1b65f0 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -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()