Skip to content

Commit 9645373

Browse files
committed
tests: add git get_head_date test for isoformat dates ending with Z
1 parent d75201a commit 9645373

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

testing/test_git.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,21 @@ def test_git_getdate_badgit(
498498
assert git_wd.get_head_date() is None
499499

500500

501+
502+
def test_git_getdate_git_2_45_0_plus(
503+
wd: WorkDir, caplog: pytest.LogCaptureFixture, monkeypatch: pytest.MonkeyPatch
504+
) -> None:
505+
wd.commit_testfile()
506+
git_wd = git.GitWorkdir(wd.cwd)
507+
fake_date_result = CompletedProcess(args=[], stdout="2024-04-30T22:33:10Z", stderr="", returncode=0)
508+
with patch.object(
509+
git,
510+
"run_git",
511+
Mock(return_value=fake_date_result),
512+
):
513+
assert git_wd.get_head_date() == date(2024, 4, 30)
514+
515+
501516
@pytest.fixture()
502517
def signed_commit_wd(monkeypatch: pytest.MonkeyPatch, wd: WorkDir) -> WorkDir:
503518
if not has_command("gpg", args=["--version"], warn=False):

0 commit comments

Comments
 (0)