From c315aefb71c12c52960b582efd24290284372e95 Mon Sep 17 00:00:00 2001 From: Sebastian Luther Date: Mon, 9 Aug 2010 07:54:45 +0200 Subject: [PATCH] Tests: resolver/test_slot_collisions: Check for slot_collision_solutions --- pym/_emerge/depgraph.py | 7 +++++-- .../tests/resolver/ResolverPlayground.py | 21 ++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index effa6d382..a912385ca 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -169,6 +169,7 @@ class _dynamic_depgraph_config(object): self._slot_collision_nodes = set() self._parent_atoms = {} self._slot_conflict_parent_atoms = set() + self._slot_conflict_handler = None self._serialized_tasks_cache = None self._scheduler_graph = None self._displayed_list = None @@ -470,8 +471,10 @@ class depgraph(object): self._show_merge_list() - handler = slot_conflict_handler(self._dynamic_config._slot_collision_info, \ - self._dynamic_config._parent_atoms, self._frozen_config.myopts) + self._dynamic_config._slot_conflict_handler = \ + slot_conflict_handler(self._dynamic_config._slot_collision_info, \ + self._dynamic_config._parent_atoms, self._frozen_config.myopts) + handler = self._dynamic_config._slot_conflict_handler conflict = handler.get_conflict() writemsg(conflict, noiselevel=-1) diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py index d9dcdc2c8..4a714445c 100644 --- a/pym/portage/tests/resolver/ResolverPlayground.py +++ b/pym/portage/tests/resolver/ResolverPlayground.py @@ -204,6 +204,7 @@ class ResolverPlayground(object): params = create_depgraph_params(options, action) success, depgraph, favorites = backtrack_depgraph( self.settings, self.trees, options, params, action, atoms, None) + depgraph.display_problems() result = ResolverPlaygroundResult(atoms, success, depgraph, favorites) portage.util.noiselimit = 0 @@ -227,7 +228,8 @@ class ResolverPlaygroundTestCase(object): "success": None, "mergelist": None, "use_changes": None, - "unstable_keywords": None + "unstable_keywords": None, + "slot_collision_solutions": None, } self.all_permutations = kwargs.pop("all_permutations", False) @@ -277,6 +279,7 @@ class ResolverPlaygroundResult(object): self.mergelist = None self.use_changes = None self.unstable_keywords = None + self.slot_collision_solutions = None if self.depgraph._dynamic_config._serialized_tasks_cache is not None: self.mergelist = [] @@ -297,3 +300,19 @@ class ResolverPlaygroundResult(object): self.unstable_keywords = set() for pkg in self.depgraph._dynamic_config._needed_unstable_keywords: self.unstable_keywords.add(pkg.cpv) + + if self.depgraph._dynamic_config._slot_conflict_handler is not None: + self.slot_collision_solutions = [] + handler = self.depgraph._dynamic_config._slot_conflict_handler + + for solution in handler.solutions: + s = {} + for pkg in solution: + changes = {} + for flag, state in solution[pkg].items(): + if state == "enabled": + changes[flag] = True + else: + changes[flag] = False + s[pkg.cpv] = changes + self.slot_collision_solutions.append(s) -- 2.26.2