test_merge_order: test blocker resolution
authorZac Medico <zmedico@gentoo.org>
Sat, 21 May 2011 03:30:30 +0000 (20:30 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 21 May 2011 03:30:30 +0000 (20:30 -0700)
pym/portage/tests/resolver/ResolverPlayground.py
pym/portage/tests/resolver/test_merge_order.py

index 298107c0692cc49baee7b6fd8a7e035d7d289a01..4f42b674373ba0a8a5535369e890fb3b5ef36555 100644 (file)
@@ -509,6 +509,9 @@ class ResolverPlaygroundTestCase(object):
                                        if got:
                                                new_got = []
                                                for cpv in got:
+                                                       if cpv[:1] == "!":
+                                                               new_got.append(cpv)
+                                                               continue
                                                        a = Atom("="+cpv, allow_repo=True)
                                                        new_got.append(a.cpv)
                                                got = new_got
@@ -516,6 +519,9 @@ class ResolverPlaygroundTestCase(object):
                                                new_expected = []
                                                for obj in expected:
                                                        if isinstance(obj, basestring):
+                                                               if obj[:1] == "!":
+                                                                       new_expected.append(obj)
+                                                                       continue
                                                                a = Atom("="+obj, allow_repo=True)
                                                                new_expected.append(a.cpv)
                                                                continue
index a59a67870945de4d03c17442967818372d25135c..6c929f729c53192d8c54fbd23a4dc253e289c8a1 100644 (file)
@@ -9,6 +9,8 @@ class MergeOrderTestCase(TestCase):
 
        def testMergeOrder(self):
                ebuilds = {
+                       "app-misc/blocker-buildtime-a-1" : {},
+                       "app-misc/blocker-runtime-a-1" : {},
                        "app-misc/circ-post-runtime-a-1": {
                                "PDEPEND": "app-misc/circ-post-runtime-b",
                        },
@@ -21,6 +23,10 @@ class MergeOrderTestCase(TestCase):
                        "app-misc/circ-runtime-b-1": {
                                "RDEPEND": "app-misc/circ-runtime-a",
                        },
+                       "app-misc/installed-blocker-a-1" : {
+                               "DEPEND" : "!app-misc/blocker-buildtime-a",
+                               "RDEPEND" : "!app-misc/blocker-runtime-a",
+                       },
                        "app-misc/some-app-a-1": {
                                "RDEPEND": "app-misc/circ-runtime-a app-misc/circ-runtime-b",
                        },
@@ -30,6 +36,10 @@ class MergeOrderTestCase(TestCase):
                }
 
                installed = {
+                       "app-misc/installed-blocker-a-1" : {
+                               "DEPEND" : "!app-misc/blocker-buildtime-a",
+                               "RDEPEND" : "!app-misc/blocker-runtime-a",
+                       }
                }
 
                test_cases = (
@@ -49,6 +59,19 @@ class MergeOrderTestCase(TestCase):
                                ["app-misc/some-app-b"],
                                success = True,
                                mergelist = ["app-misc/circ-post-runtime-a-1", "app-misc/circ-post-runtime-b-1", "app-misc/some-app-b-1"]),
+                       # installed package has buildtime-only blocker
+                       # that should be ignored
+                       ResolverPlaygroundTestCase(
+                               ["app-misc/blocker-buildtime-a"],
+                               success = True,
+                               mergelist = ["app-misc/blocker-buildtime-a-1"]),
+                       # installed package has runtime blocker that
+                       # should cause it to be uninstalled
+                       # TODO: distinguish between install/uninstall tasks in mergelist
+                       ResolverPlaygroundTestCase(
+                               ["app-misc/blocker-runtime-a"],
+                               success = True,
+                               mergelist = ["app-misc/blocker-runtime-a-1", "app-misc/installed-blocker-a-1", "!app-misc/blocker-runtime-a"]),
                )
 
                playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)