aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-06-30 23:54:40 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2023-07-01 12:00:35 +0300
commit4e9dbc12ea3b269c021bca30599b043a448acf26 (patch)
tree712da3d166b7b2ce159fb01544e407dd8297ed96 /tests
parentRubyCompatCheck: new check for new USE_RUBY compatible values (diff)
downloadpkgcheck-4e9dbc12ea3b269c021bca30599b043a448acf26.tar.gz
pkgcheck-4e9dbc12ea3b269c021bca30599b043a448acf26.tar.bz2
pkgcheck-4e9dbc12ea3b269c021bca30599b043a448acf26.zip
OldPythonCompat: check for old PYTHON_COMPAT in modified ebuilds
Resolves: https://github.com/pkgcore/pkgcheck/issues/591 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/checks/test_git.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/checks/test_git.py b/tests/checks/test_git.py
index 03687451..ab6efee2 100644
--- a/tests/checks/test_git.py
+++ b/tests/checks/test_git.py
@@ -394,6 +394,10 @@ class TestGitPkgCommitsCheck(ReportTestCase):
# initialize parent repo
self.parent_git_repo = make_git_repo()
self.parent_repo = make_repo(self.parent_git_repo.path, repo_id="gentoo", arches=["amd64"])
+ os.makedirs(pjoin(self.parent_git_repo.path, "profiles/desc"), exist_ok=True)
+ with open(pjoin(self.parent_git_repo.path, "profiles/desc/python_targets.desc"), "w") as f:
+ f.write("python3_10 - Build with Python 3.10\n")
+ f.write("python3_11 - Build with Python 3.11\n")
self.parent_git_repo.add_all("initial commit")
# create a stub pkg and commit it
self.parent_repo.create_ebuild("cat/pkg-0", eapi="7")
@@ -751,6 +755,29 @@ class TestGitPkgCommitsCheck(ReportTestCase):
expected = git_mod.EAPIChangeWithoutRevbump(pkg=CPV("cat/pkg-1"))
assert r == expected
+ def test_old_python_compat(self):
+ # good compat
+ self.child_repo.create_ebuild("cat/pkg-0", data="PYTHON_COMPAT=( python3_10 python3_11 )")
+ self.child_git_repo.add_all("cat/pkg-0")
+ self.init_check()
+ self.assertNoReport(self.check, self.source)
+ # one old compat
+ self.child_repo.create_ebuild("cat/pkg-0", data="PYTHON_COMPAT=( python3_9 python3_10 )")
+ self.child_git_repo.add_all("cat/pkg-0")
+ self.init_check()
+ r = self.assertReport(self.check, self.source)
+ expected = git_mod.OldPythonCompat(["python3_9"], pkg=CPV("cat/pkg-0"))
+ assert r == expected
+ # two old compat
+ self.child_repo.create_ebuild(
+ "cat/pkg-0", data="PYTHON_COMPAT=( python3_9 python3_8 python3_10 )"
+ )
+ self.child_git_repo.add_all("cat/pkg-0")
+ self.init_check()
+ r = self.assertReport(self.check, self.source)
+ expected = git_mod.OldPythonCompat(["python3_8", "python3_9"], pkg=CPV("cat/pkg-0"))
+ assert r == expected
+
class TestGitEclassCommitsCheck(ReportTestCase):
check_kls = git_mod.GitEclassCommitsCheck