commit:     eeb4c29a64927efbaa7028153230367651bcf3b7
Author:     Andrei Horodniceanu <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Sat Oct 21 14:38:36 2023 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Dec 24 19:29:16 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=eeb4c29a

tests/resolver: test depclean order with IDEPEND and circular deps

Bug: https://bugs.gentoo.org/916135
Signed-off-by: Andrei Horodniceanu <a.horodniceanu <AT> proton.me>
Closes: https://github.com/gentoo/portage/pull/1147
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/tests/resolver/test_depclean_order.py | 50 +++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/lib/portage/tests/resolver/test_depclean_order.py 
b/lib/portage/tests/resolver/test_depclean_order.py
index 08dd249e11..867b1a54ca 100644
--- a/lib/portage/tests/resolver/test_depclean_order.py
+++ b/lib/portage/tests/resolver/test_depclean_order.py
@@ -1,6 +1,8 @@
 # Copyright 2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+import pytest
+
 from portage.tests import TestCase
 from portage.tests.resolver.ResolverPlayground import (
     ResolverPlayground,
@@ -57,3 +59,51 @@ class SimpleDepcleanTestCase(TestCase):
                 self.assertEqual(test_case.test_success, True, 
test_case.fail_msg)
         finally:
             playground.cleanup()
+
+    @pytest.mark.xfail()
+    def testIDEPENDDepclean(self):
+        ebuilds = {
+            "dev-util/A-1": {},
+            "dev-libs/B-1": {
+                "EAPI": "8",
+                "IDEPEND": "dev-util/A",
+                "RDEPEND": "dev-libs/B:=",
+            },
+            "dev-libs/C-1": {},
+        }
+
+        installed = {
+            "dev-util/A-1": {},
+            "dev-libs/B-1": {
+                "EAPI": "8",
+                "IDEPEND": "dev-util/A",
+                "RDEPEND": "dev-libs/B:0/0=",
+            },
+            "dev-libs/C-1": {},
+        }
+
+        world = ("dev-libs/C",)
+
+        test_cases = (
+            # Remove dev-libs/B first because it IDEPENDs on dev-util/A
+            ResolverPlaygroundTestCase(
+                [],
+                options={"--depclean": True},
+                success=True,
+                ordered=True,
+                cleanlist=[
+                    "dev-libs/B-1",
+                    "dev-util/A-1",
+                ],
+            ),
+        )
+
+        playground = ResolverPlayground(
+            ebuilds=ebuilds, installed=installed, world=world
+        )
+        try:
+            for test_case in test_cases:
+                playground.run_TestCase(test_case)
+                self.assertEqual(test_case.test_success, True, 
test_case.fail_msg)
+        finally:
+            playground.cleanup()

Reply via email to