diff options
author | Sebastian Luther <SebastianLuther@gmx.de> | 2010-08-07 10:22:46 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-07 18:48:59 -0700 |
commit | 7a0227049551d919d3bb766a57834d7dc3ccc9c8 (patch) | |
tree | 3872431ec17f7b612077d6b493458bca939f6bc4 | |
parent | 44ade54c617432cc8836e5bf862705c347410cc9 (diff) | |
download | portage-7a0227049551d919d3bb766a57834d7dc3ccc9c8.tar.gz portage-7a0227049551d919d3bb766a57834d7dc3ccc9c8.tar.bz2 portage-7a0227049551d919d3bb766a57834d7dc3ccc9c8.zip |
Test: resolver/test_autounmask: Check the suggested use changes
-rw-r--r-- | pym/portage/tests/resolver/ResolverPlayground.py | 9 | ||||
-rw-r--r-- | pym/portage/tests/resolver/test_autounmask.py | 47 |
2 files changed, 31 insertions, 25 deletions
diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py index 5d6d9d123..6f658d8c1 100644 --- a/pym/portage/tests/resolver/ResolverPlayground.py +++ b/pym/portage/tests/resolver/ResolverPlayground.py @@ -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 diff --git a/pym/portage/tests/resolver/test_autounmask.py b/pym/portage/tests/resolver/test_autounmask.py index 19d91484f..74cd98bea 100644 --- a/pym/portage/tests/resolver/test_autounmask.py +++ b/pym/portage/tests/resolver/test_autounmask.py @@ -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() |