commit:     996babb5aa005edef4abb86de1dc585d630ac21d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 18 13:26:47 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Feb 19 19:19:44 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=996babb5

tests: resolver: add basic BDEPEND + IDEPEND tests

These aren't very interesting but they at least check that
BDEPEND/IDEPEND affect dependency resolution.

I started to look at testing --with-bdeps but got into
the weeds.

Signed-off-by: Sam James <sam <AT> gentoo.org>

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

diff --git a/lib/portage/tests/resolver/test_eapi.py 
b/lib/portage/tests/resolver/test_eapi.py
index 1d6c58633..5d425ccdb 100644
--- a/lib/portage/tests/resolver/test_eapi.py
+++ b/lib/portage/tests/resolver/test_eapi.py
@@ -185,3 +185,46 @@ class EAPITestCase(TestCase):
                 self.assertEqual(test_case.test_success, True, 
test_case.fail_msg)
         finally:
             playground.cleanup()
+
+    def testBdepend(self):
+        ebuilds = {
+            "dev-libs/A-1.0": {"EAPI": 7},
+            "dev-libs/B-1.0": {"EAPI": 7, "BDEPEND": "dev-libs/A"},
+        }
+
+        # Verify that BDEPEND is considered at all.
+        test_case = ResolverPlaygroundTestCase(
+            ["=dev-libs/B-1.0"],
+            success=True,
+            mergelist=["dev-libs/A-1.0", "dev-libs/B-1.0"],
+        )
+
+        playground = ResolverPlayground(ebuilds=ebuilds, debug=True)
+        try:
+            playground.run_TestCase(test_case)
+            self.assertEqual(test_case.test_success, True, test_case.fail_msg)
+        finally:
+            playground.cleanup()
+
+    def testIdepend(self):
+        ebuilds = {
+            "dev-libs/A-1.0": {"EAPI": 8},
+            "dev-libs/B-1.0": {"EAPI": 8, "IDEPEND": "dev-libs/A"},
+        }
+
+        test_cases = (
+            # Verify that IDEPEND is considered at all.
+            ResolverPlaygroundTestCase(
+                ["=dev-libs/B-1.0"],
+                success=True,
+                mergelist=["dev-libs/A-1.0", "dev-libs/B-1.0"],
+            ),
+        )
+
+        playground = ResolverPlayground(ebuilds=ebuilds)
+        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