aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-03-11 09:10:29 +0200
committerArthur Zamarin <arthurzam@gentoo.org>2023-03-11 09:10:29 +0200
commit7410c137c57c645b5e502f279eb183a14d7ef216 (patch)
treed87a6731181eceb4b85799d7ddc3921faaabf3fd /tests
parentnew release 0.10.23 (diff)
downloadpkgcheck-7410c137c57c645b5e502f279eb183a14d7ef216.tar.gz
pkgcheck-7410c137c57c645b5e502f279eb183a14d7ef216.tar.bz2
pkgcheck-7410c137c57c645b5e502f279eb183a14d7ef216.zip
GitPkgCommitsCheck: fix modification check for added ebuild in pkgset
When commit range has modification for multiple versions, with one of them modifying a newly added version in the same range, it wouldn't find the correct base commit and fail. Fix it by grouping based on fullver. The test is special with time.sleep, since I need the commits be in different seconds, otherwise the sorting by time might be bad. Resolves: https://github.com/pkgcore/pkgcheck/issues/563 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/checks/test_git.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/checks/test_git.py b/tests/checks/test_git.py
index 7eb7907a..03687451 100644
--- a/tests/checks/test_git.py
+++ b/tests/checks/test_git.py
@@ -1,5 +1,6 @@
import os
import textwrap
+import time
from datetime import datetime, timedelta
from unittest.mock import patch
@@ -736,6 +737,20 @@ class TestGitPkgCommitsCheck(ReportTestCase):
self.init_check()
self.assertNoReport(self.check, self.source)
+ def test_modified_added_file(self):
+ self.child_repo.create_ebuild("cat/pkg-0", homepage="https://gentoo.org")
+ self.child_git_repo.add_all("cat/pkg: update HOMEPAGE")
+ time.sleep(1)
+ self.child_repo.create_ebuild("cat/pkg-1", eapi="7")
+ self.child_git_repo.add_all("cat/pkg: add 1")
+ time.sleep(1)
+ self.child_repo.create_ebuild("cat/pkg-1", eapi="8")
+ self.child_git_repo.add_all("cat/pkg: bump EAPI")
+ self.init_check()
+ r = self.assertReport(self.check, self.source)
+ expected = git_mod.EAPIChangeWithoutRevbump(pkg=CPV("cat/pkg-1"))
+ assert r == expected
+
class TestGitEclassCommitsCheck(ReportTestCase):
check_kls = git_mod.GitEclassCommitsCheck