Skip to content

Commit

Permalink
tests: add git get_head_date test for isoformat dates ending with Z
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-- committed May 2, 2024
1 parent d75201a commit 9645373
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions testing/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,21 @@ def test_git_getdate_badgit(
assert git_wd.get_head_date() is None



def test_git_getdate_git_2_45_0_plus(
wd: WorkDir, caplog: pytest.LogCaptureFixture, monkeypatch: pytest.MonkeyPatch
) -> None:
wd.commit_testfile()
git_wd = git.GitWorkdir(wd.cwd)
fake_date_result = CompletedProcess(args=[], stdout="2024-04-30T22:33:10Z", stderr="", returncode=0)
with patch.object(
git,
"run_git",
Mock(return_value=fake_date_result),
):
assert git_wd.get_head_date() == date(2024, 4, 30)


@pytest.fixture()
def signed_commit_wd(monkeypatch: pytest.MonkeyPatch, wd: WorkDir) -> WorkDir:
if not has_command("gpg", args=["--version"], warn=False):
Expand Down

0 comments on commit 9645373

Please sign in to comment.