def test_skip_first_commit(self, git_repo): ts1 = 1589238000 ts2 = 1589238180 timestamps = ( timestamp(ts2, "commit 2"), timestamp(ts1, "commit 1"), ) assert get_mtime(timestamps[1:], skip_first_commit=True) is None assert get_mtime(timestamps, skip_first_commit=True) == ts2
def test_dirty(self, git_repo): ts = 1589238246 timestamps = ( timestamp(ts, None), timestamp(ts - 60, "commit message"), timestamp(ts - 120, "first message"), ) assert get_mtime(timestamps, ignore_commits=r'ignore') == ts
def test_first(self, git_repo): ts1 = 1589238000 ts2 = 1589238180 timestamps = ( timestamp(ts2, "commit 2"), timestamp(ts1, "commit 1"), ) assert get_mtime(timestamps, strategy='first') == ts1
def test_ignore_commits(self, git_repo): ts1 = 1589238000 ts2 = 1589238180 timestamps = ( timestamp(ts2, "[skip] commit 2"), timestamp(ts1, "commit 1"), ) assert get_mtime(timestamps, ignore_commits=r'\[skip\]') == ts1
def test_clean(self, git_repo): ts = 1589238186 timestamps = (timestamp(ts, "commit message"), ) assert get_mtime(timestamps) == ts
def test_not_in_git(self): ts = 1589238006 timestamps = (timestamp(ts, None), ) assert get_mtime(timestamps) == ts
def test_missing_file(self, git_repo): timestamps = () assert get_mtime(timestamps) is None