-
-
Notifications
You must be signed in to change notification settings - Fork 223
Closed
Description
When running testing/test_git.py::test_git_getdate
at 2025-06-12T01:12:59+02:00, the following error happens:
def test_git_getdate(wd: WorkDir) -> None:
# TODO: case coverage for git wd parse
today = datetime.now(timezone.utc).date()
def parse_date() -> date:
parsed = git.parse(os.fspath(wd.cwd), Configuration())
assert parsed is not None
assert parsed.node_date is not None
return parsed.node_date
git_wd = git.GitWorkdir(wd.cwd)
assert git_wd.get_head_date() is None
assert parse_date() == today
wd.commit_testfile()
> assert git_wd.get_head_date() == today
E AssertionError: assert datetime.date(2025, 6, 12) == datetime.date(2025, 6, 11)
E + where datetime.date(2025, 6, 12) = get_head_date()
E + where get_head_date = GitWorkdir(path=PosixPath('/tmp/pytest-of-user/pytest-106/test_git_getdate0/wd')).get_head_date
GitWorkdir.get_head_date()
returns the date in the local timezone, while the test compares it to the date in the UTC timezone. The parsed date seems to be used for generating calendar-based versions. I’m not sure what would be the right behavior for that. On one hand, it would be weird if the same project, released at the same (absolute) time in different time zones, would get different versions. On the other hand, it would be a bit surprising if the date in the generated version doesn’t match the date in the local timezone.
Metadata
Metadata
Assignees
Labels
No labels