def safe_pack(self): """ returns exceptions instead of throwing them to be consistent with events that must catch their own BadSongFile exceptions since generate a set of exceptions instead of a single one """ try: self._pack_hook() ret = self.pack() # Remove owner of this file only after packing. Otherwise packing # will not serialize the owner correctly into the airtime request owners.remove_file_owner(self.path) return ret except BadSongFile as e: return [e]
def test_remove_file_owner(self): owners.reset_owners() self.assertTrue(owners.add_file_owner(self.f, 123)) self.assertTrue(owners.remove_file_owner(self.f)) self.assertFalse(owners.remove_file_owner(self.f))