Add a fake _test_ option to myopts that can be used for conditional test code.
authorZac Medico <zmedico@gentoo.org>
Thu, 5 Aug 2010 20:34:47 +0000 (13:34 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 5 Aug 2010 20:37:33 +0000 (13:37 -0700)
pym/_emerge/depgraph.py
pym/portage/tests/resolver/ResolverPlayground.py

index 15004821591946b68aaf9822c5215b0b468ca32b..cc697ccf760c732e948898d6676615681b5f3e8a 100644 (file)
@@ -66,10 +66,10 @@ class _frozen_depgraph_config(object):
                if settings.get("PORTAGE_DEBUG", "") == "1":
                        self.edebug = 1
                self.spinner = spinner
-               if "/" in trees:
-                       self._running_root = trees["/"]["root_config"]
-               else:
+               if "_test_" in myopts and "/" not in trees:
                        self._running_root = trees[self.target_root]["root_config"]
+               else:
+                       self._running_root = trees["/"]["root_config"]
                self._opts_no_restart = frozenset(["--buildpkgonly",
                        "--fetchonly", "--fetch-all-uri", "--pretend"])
                self.pkgsettings = {}
index 9034deb88cdcb4305dd0284d7e352d4a1181b400..a9954fef1eb43d0dcc30aa6c97b280f53f8b638f 100644 (file)
@@ -180,6 +180,9 @@ class ResolverPlayground(object):
                myopts["--root"] = self.root
                myopts["--config-root"] = self.root
                myopts["--root-deps"] = "rdeps"
+               # Add a fake _test_ option that can be used for
+               # conditional test code.
+               myopts["_test_"] = True
                
                portage.util.noiselimit = -2
                myparams = create_depgraph_params(myopts, myaction)