Skip to content

Commit 023c13d

Browse files
committed
Updated the test code to ignore the "Sending event" log messages.
1 parent 5123a41 commit 023c13d

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

test/test_importer.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,6 +1582,8 @@ def __run(self, import_paths, singletons=True, detailed=False):
15821582
with capture_log() as logs:
15831583
self.importer.run()
15841584

1585+
logs = [line for line in logs if not line.startswith('Sending event:')]
1586+
15851587
self.assertEqual(len(self.lib.items()), 0)
15861588
self.assertEqual(len(self.lib.albums()), 0)
15871589

@@ -1590,41 +1592,35 @@ def __run(self, import_paths, singletons=True, detailed=False):
15901592
def test_import_pretend(self):
15911593
logs = self.__run(self.import_paths)
15921594

1593-
self.assertEqual(len(logs), 3)
1594-
self.assertEqual(logs[1], self.import_files[0])
1595-
self.assertEqual(logs[2], self.import_files[1])
1595+
self.assertEqual(logs, self.import_files)
15961596

15971597
def test_import_pretend_empty(self):
15981598
logs = self.__run([self.empty_path])
15991599

1600-
self.assertEqual(len(logs), 2)
1601-
self.assertEqual(logs[1], 'No files imported from {0}'
1602-
.format(displayable_path(self.empty_path)))
1600+
self.assertEqual(logs, ['No files imported from {0}'
1601+
.format(displayable_path(self.empty_path))])
16031602

16041603
def test_import_singletons_pretend_detailed(self):
16051604
logs = self.__run(self.import_paths, detailed=True)
16061605

1607-
self.assertEqual(len(logs), 3)
1608-
self.assertEqual(logs[1], 'Singleton: %s' % self.import_files[0])
1609-
self.assertEqual(logs[2], 'Singleton: %s' % self.import_paths[1])
1606+
self.assertEqual(logs, [
1607+
'Singleton: %s' % self.import_files[0],
1608+
'Singleton: %s' % self.import_paths[1]])
16101609

16111610
def test_import_album_pretend_detailed(self):
16121611
logs = self.__run(self.import_paths, singletons=False, detailed=True)
16131612

1614-
self.assertEqual(len(logs), 5)
1615-
self.assertEqual(logs[1],
1616-
'Album %s' % displayable_path(self.import_paths[0]))
1617-
self.assertEqual(logs[2], self.import_files[0])
1618-
self.assertEqual(logs[3],
1619-
'Album %s' % displayable_path(self.import_paths[1]))
1620-
self.assertEqual(logs[4], self.import_paths[1])
1613+
self.assertEqual(logs, [
1614+
'Album %s' % displayable_path(self.import_paths[0]),
1615+
self.import_files[0],
1616+
'Album %s' % displayable_path(self.import_paths[1]),
1617+
self.import_paths[1]])
16211618

16221619
def test_import_pretend_empty_detailed(self):
16231620
logs = self.__run([self.empty_path], detailed=True)
16241621

1625-
self.assertEqual(len(logs), 2)
1626-
self.assertEqual(logs[1], 'No files imported from {0}'
1627-
.format(displayable_path(self.empty_path)))
1622+
self.assertEqual(logs, ['No files imported from {0}'
1623+
.format(displayable_path(self.empty_path))])
16281624

16291625

16301626
def suite():

0 commit comments

Comments
 (0)