def test_read_write(self): with tempfile.TemporaryDirectory() as tempdir: commit_list_path = f'{tempdir}/commitlist.csv' initial = CommitList.create_new(commit_list_path, 'v1.5.0', '7543e7e558') initial.write_to_disk() expected = CommitList.from_existing(commit_list_path) expected.commits[-2].category = 'foobar' expected.write_to_disk() commit_list = CommitList.from_existing(commit_list_path) for commit, expected in zip(commit_list.commits, expected.commits): self.assertEqual(commit, expected)
def __init__(self, path, category='Uncategorized'): self.cache = get_commit_data_cache() self.commits = CommitList.from_existing(path) # Special categories: 'Uncategorized' # All other categories must be real self.category = category
def test_update_to(self): with tempfile.TemporaryDirectory() as tempdir: commit_list_path = f'{tempdir}/commitlist.csv' initial = CommitList.create_new(commit_list_path, 'v1.5.0', '7543e7e558') initial.commits[-2].category = 'foobar' self.assertEqual(len(initial.commits), 2143) initial.write_to_disk() commit_list = CommitList.from_existing(commit_list_path) commit_list.update_to('5702a28b26') self.assertEqual(len(commit_list.commits), 2143 + 4) self.assertEqual(commit_list.commits[-5], initial.commits[-1])