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>
Thu, 26 May 2011 03:42:58 +0000 (20:42 -0700)
pym/portage/tests/resolver/ResolverPlayground.py
pym/portage/tests/resolver/test_merge_order.py

index 402db7baee132eedcff133b77f92320914091ee1..667731b1bf5395f5ccb517c521e77b1d52f45712 100644 (file)
@@ -502,6 +502,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
@@ -509,6 +512,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)