Test: resolver/test_autounmask: Check the suggested use changes
authorSebastian Luther <SebastianLuther@gmx.de>
Sat, 7 Aug 2010 08:22:46 +0000 (10:22 +0200)
committerZac Medico <zmedico@gentoo.org>
Sun, 8 Aug 2010 01:48:59 +0000 (18:48 -0700)
pym/portage/tests/resolver/ResolverPlayground.py
pym/portage/tests/resolver/test_autounmask.py

index 5d6d9d1235680a7e99e71f34ded92fdfcb1d0651..6f658d8c18e47ccd007f5783f7bd17805e3995a9 100644 (file)
@@ -203,7 +203,7 @@ class ResolverPlaygroundResult(object):
                self.depgraph = mydepgraph
                self.favorites = favorites
                self.mergelist = None
-               self.use_changes = self.depgraph._dynamic_config._needed_use_config_changes
+               self.use_changes = None 
 
                if self.depgraph._dynamic_config._serialized_tasks_cache is not None:
                        self.mergelist = []
@@ -212,3 +212,10 @@ class ResolverPlaygroundResult(object):
                                        self.mergelist.append(x.atom)
                                else:
                                        self.mergelist.append(x.cpv)
+               
+               if self.depgraph._dynamic_config._needed_use_config_changes:
+                       self.use_changes = {}
+                       for pkg, needed_use_config_changes in \
+                               self.depgraph._dynamic_config._needed_use_config_changes.items():
+                               new_use, changes = needed_use_config_changes
+                               self.use_changes[pkg.cpv] = changes
index 19d91484f09cc33ac4c05934e5401ceea06d3b07..74cd98bea3c3e09bf72c411c68c3ab68ba2eeff3 100644 (file)
@@ -41,69 +41,68 @@ class AutounmaskTestCase(TestCase):
                                #Test USE changes.
                                #The simple case.
 
-                               (["dev-libs/A:1"], {"--autounmask": "n"}, None, False, None),
+                               (["dev-libs/A:1"], {"--autounmask": "n"}, None, False, None, None),
                                (["dev-libs/A:1"], {"--autounmask": True}, None, False, \
-                                       ["dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1"]),
+                                       ["dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1"], { "dev-libs/B-1": {"foo": True} }),
 
                                #Make sure we restart if needed.
-
                                (["dev-libs/B", "dev-libs/A:1"], {"--autounmask": True}, None, False, \
-                                       ["dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1"]),
+                                       ["dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1"], { "dev-libs/B-1": {"foo": True} }),
                                (["dev-libs/A:1", "dev-libs/B"], {"--autounmask": True}, None, False, \
-                                       ["dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1"]),
+                                       ["dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1"], { "dev-libs/B-1": {"foo": True} }),
                                (["dev-libs/A:1", "dev-libs/A:2"], {"--autounmask": True}, None, False, \
-                                       ["dev-libs/D-1", "dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1", "dev-libs/A-2"]),
+                                       ["dev-libs/D-1", "dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1", "dev-libs/A-2"], { "dev-libs/B-1": {"foo": True, "bar": True} }),
                                (["dev-libs/B", "dev-libs/A:1", "dev-libs/A:2"], {"--autounmask": True}, None, False, \
-                                       ["dev-libs/D-1", "dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1", "dev-libs/A-2"]),
+                                       ["dev-libs/D-1", "dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1", "dev-libs/A-2"], { "dev-libs/B-1": {"foo": True, "bar": True} }),
                                (["dev-libs/A:1", "dev-libs/B", "dev-libs/A:2"], {"--autounmask": True}, None, False, \
-                                       ["dev-libs/D-1", "dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1", "dev-libs/A-2"]),
+                                       ["dev-libs/D-1", "dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1", "dev-libs/A-2"], { "dev-libs/B-1": {"foo": True, "bar": True} }),
                                (["dev-libs/A:1", "dev-libs/A:2", "dev-libs/B"], {"--autounmask": True}, None, False, \
-                                       ["dev-libs/D-1", "dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1", "dev-libs/A-2"]),
+                                       ["dev-libs/D-1", "dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1", "dev-libs/A-2"], { "dev-libs/B-1": {"foo": True, "bar": True} }),
 
                                #Test keywording.
                                #The simple case.
 
-                               (["app-misc/Z"], {"--autounmask": "n"}, None, False, None),
+                               (["app-misc/Z"], {"--autounmask": "n"}, None, False, None, None),
                                (["app-misc/Z"], {"--autounmask": True}, None, False, \
-                                       ["app-misc/Y-1", "app-misc/Z-1"]),
+                                       ["app-misc/Y-1", "app-misc/Z-1"], None),
 
                                #Make sure that the backtracking for slot conflicts handles our mess.
 
                                (["=app-misc/V-1", "app-misc/W"], {"--autounmask": True}, None, False, \
-                                       ["app-misc/W-2", "app-misc/V-1"]),
+                                       ["app-misc/W-2", "app-misc/V-1"], None),
                                (["app-misc/W", "=app-misc/V-1"], {"--autounmask": True}, None, False, \
-                                       ["app-misc/W-2", "app-misc/V-1"]),
+                                       ["app-misc/W-2", "app-misc/V-1"], None),
 
                                #Mixed testing
                                #Make sure we don't change use for something in a || dep if there is another choice
                                #that needs no change.
 
                                (["=sci-libs/K-1"], {"--autounmask": True}, None, True, \
-                                       ["sci-libs/P-1", "sci-libs/K-1"]),
+                                       ["sci-libs/P-1", "sci-libs/K-1"], None),
                                (["=sci-libs/K-2"], {"--autounmask": True}, None, True, \
-                                       ["sci-libs/P-1", "sci-libs/K-2"]),
+                                       ["sci-libs/P-1", "sci-libs/K-2"], None),
                                (["=sci-libs/K-3"], {"--autounmask": True}, None, True, \
-                                       ["sci-libs/P-1", "sci-libs/K-3"]),
+                                       ["sci-libs/P-1", "sci-libs/K-3"], None),
                                (["=sci-libs/K-4"], {"--autounmask": True}, None, True, \
-                                       ["sci-libs/P-1", "sci-libs/K-4"]),
+                                       ["sci-libs/P-1", "sci-libs/K-4"], None),
                                (["=sci-libs/K-5"], {"--autounmask": True}, None, True, \
-                                       ["sci-libs/P-1", "sci-libs/K-5"]),
+                                       ["sci-libs/P-1", "sci-libs/K-5"], None),
                                (["=sci-libs/K-6"], {"--autounmask": True}, None, True, \
-                                       ["sci-libs/P-1", "sci-libs/K-6"]),
+                                       ["sci-libs/P-1", "sci-libs/K-6"], None),
 
                                #Make sure we prefer use changes over keyword changes.
                                (["=sci-libs/K-7"], {"--autounmask": True}, None, False, \
-                                       ["sci-libs/L-1", "sci-libs/K-7"]),
+                                       ["sci-libs/L-1", "sci-libs/K-7"], { "sci-libs/L-1": { "bar": True } }),
                                (["=sci-libs/K-8"], {"--autounmask": True}, None, False, \
-                                       ["sci-libs/L-1", "sci-libs/K-8"]),
+                                       ["sci-libs/L-1", "sci-libs/K-8"], { "sci-libs/L-1": { "bar": True } }),
                        )
 
                playground = ResolverPlayground(ebuilds=ebuilds)
                try:
                        for atoms, options, action, \
-                               expected_result, expected_mergelist in requests:
+                               expected_result, expected_mergelist, expected_use_changes in requests:
                                result = playground.run(atoms, options, action)
-                               self.assertEqual((result.success, result.mergelist),
-                                       (expected_result, expected_mergelist))
+                               self.assertEqual((result.success, result.mergelist, result.use_changes),
+                                       (expected_result, expected_mergelist, expected_use_changes))
                finally:
                        playground.cleanup()