summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-08 14:00:55 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-08 14:00:55 -0700
commit4488d106a4da0e4e201ff74555ac55974267edbe (patch)
tree7273258e99c94d275500a7edd7f71a523be67110
parent9ab2783b73c24195789a9575aa11c4aa8141b564 (diff)
downloadportage-4488d106a4da0e4e201ff74555ac55974267edbe.tar.gz
portage-4488d106a4da0e4e201ff74555ac55974267edbe.tar.bz2
portage-4488d106a4da0e4e201ff74555ac55974267edbe.zip
Make ResolverPlayground.run() use try/finally when saving/restoring
global variable settings.
-rw-r--r--pym/portage/tests/resolver/ResolverPlayground.py40
1 files changed, 22 insertions, 18 deletions
diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py
index 0b950059f..5c04afd98 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -315,25 +315,29 @@ class ResolverPlayground(object):
if self.debug:
options["--debug"] = True
- if not self.debug:
- portage.util.noiselimit = -2
- _emerge.emergelog._disable = True
-
- if options.get("--depclean"):
- rval, cleanlist, ordered, req_pkg_count = \
- calc_depclean(self.settings, self.trees, None,
- options, "depclean", atoms, None)
- result = ResolverPlaygroundDepcleanResult( \
- atoms, rval, cleanlist, ordered, req_pkg_count)
- else:
- 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)
+ global_noiselimit = portage.util.noiselimit
+ global_emergelog_disable = _emerge.emergelog._disable
+ try:
- portage.util.noiselimit = 0
- _emerge.emergelog._disable = False
+ if not self.debug:
+ portage.util.noiselimit = -2
+ _emerge.emergelog._disable = True
+
+ if options.get("--depclean"):
+ rval, cleanlist, ordered, req_pkg_count = \
+ calc_depclean(self.settings, self.trees, None,
+ options, "depclean", atoms, None)
+ result = ResolverPlaygroundDepcleanResult( \
+ atoms, rval, cleanlist, ordered, req_pkg_count)
+ else:
+ 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)
+ finally:
+ portage.util.noiselimit = global_noiselimit
+ _emerge.emergelog._disable = global_emergelog_disable
return result