From 4d5e29f26b536dc261fba77ab12585c49642f91a Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Sat, 28 Dec 2024 21:50:39 +0800 Subject: [PATCH] gitea: use the full date string as commit version Only using the date part is too coarse. Also date could be different across timezones and thus confusing. --- nvchecker_source/gitea.py | 2 +- tests/test_gitea.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nvchecker_source/gitea.py b/nvchecker_source/gitea.py index 94156b7..a3b87e3 100644 --- a/nvchecker_source/gitea.py +++ b/nvchecker_source/gitea.py @@ -51,7 +51,7 @@ async def get_version( ] else: return RichResult( - version = data[0]['commit']['committer']['date'].split('T', 1)[0].replace('-', ''), + version = data[0]['commit']['committer']['date'], revision = data[0]['sha'], url = data[0]['html_url'], ) diff --git a/tests/test_gitea.py b/tests/test_gitea.py index bc2fbf8..fd3885e 100644 --- a/tests/test_gitea.py +++ b/tests/test_gitea.py @@ -10,8 +10,8 @@ async def test_gitea(get_version): ver = await get_version("example", { "source": "gitea", "gitea": "gitea/tea"}) - assert len(ver) == 8 - assert ver.isdigit() + assert ver.startswith('20') + assert 'T' in ver @pytest.mark.flaky(reruns=10) async def test_gitea_max_tag_with_include(get_version):