Use consistent paths of repositories in test suite and clean some code.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Sat, 13 Jul 2013 11:07:16 +0000 (13:07 +0200)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Sat, 13 Jul 2013 11:07:16 +0000 (13:07 +0200)
pym/portage/tests/dbapi/test_fakedbapi.py
pym/portage/tests/ebuild/test_config.py
pym/portage/tests/resolver/ResolverPlayground.py

index e3843f0a4485751b557fbad848dd4eda3fb9ad49..771356350f17ac72c004ee9061664ac9aabb5760 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011-2012 Gentoo Foundation
+# Copyright 2011-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import tempfile
@@ -42,10 +42,12 @@ class TestFakedbapi(TestCase):
 
                tempdir = tempfile.mkdtemp()
                try:
-                       portdir = os.path.join(tempdir, "usr/portage")
-                       os.makedirs(portdir)
+                       test_repo = os.path.join(tempdir, "var", "repositories", "test_repo")
+                       os.makedirs(os.path.join(test_repo, "profiles"))
+                       with open(os.path.join(test_repo, "profiles", "repo_name"), "w") as f:
+                               f.write("test_repo")
                        env = {
-                               "PORTDIR": portdir,
+                               "PORTAGE_REPOSITORIES": "[DEFAULT]\nmain-repo = test_repo\n[test_repo]\nlocation = %s" % test_repo
                        }
                        fakedb = fakedbapi(settings=config(config_profile_path="",
                                env=env, eprefix=tempdir))
index cee2435a78125e67a728e974b0c77a54194c930a..275663c8956af304c6a3677332b3fa6824addd43 100644 (file)
@@ -92,7 +92,7 @@ class ConfigTestCase(TestCase):
                try:
                        portage.util.noiselimit = -2
 
-                       license_group_locations = (os.path.join(playground.portdir, "profiles"),)
+                       license_group_locations = (os.path.join(playground.settings.repositories["test_repo"].location, "profiles"),)
                        pkg_license = os.path.join(playground.eroot, "etc", "portage")
 
                        lic_man = LicenseManager(license_group_locations, pkg_license)
@@ -244,8 +244,8 @@ class ConfigTestCase(TestCase):
                new_repo_config = settings.repositories["new_repo"]
                old_repo_config = settings.repositories["old_repo"]
                self.assertTrue(len(new_repo_config.masters) > 0, "new_repo has no default master")
-               self.assertEqual(new_repo_config.masters[0].user_location, playground.portdir,
-                       "new_repo default master is not PORTDIR")
+               self.assertEqual(new_repo_config.masters[0].user_location, playground.settings.repositories["test_repo"].location,
+                       "new_repo default master is not test_repo")
                self.assertEqual(new_repo_config.thin_manifest, True,
                        "new_repo_config.thin_manifest != True")
 
index a311c08fee8be8e931b5685e959ed0546a8ee221..b17917a8acf800036eafa4a7917a1a1bbb43a5de 100644 (file)
@@ -75,9 +75,7 @@ class ResolverPlayground(object):
                        self.target_root = os.sep
                self.distdir = os.path.join(self.eroot, "var", "portage", "distfiles")
                self.pkgdir = os.path.join(self.eprefix, "pkgdir")
-               self.portdir = os.path.join(self.eroot, "usr/portage")
                self.vdbdir = os.path.join(self.eroot, "var/db/pkg")
-               os.makedirs(self.portdir)
                os.makedirs(self.vdbdir)
 
                if not debug:
@@ -106,11 +104,9 @@ class ResolverPlayground(object):
                """
                if repo not in self._repositories:
                        if repo == "test_repo":
-                               repo_path = self.portdir
                                self._repositories["DEFAULT"] = {"main-repo": repo}
-                       else:
-                               repo_path = os.path.join(self.eroot, "usr", "local", repo)
 
+                       repo_path = os.path.join(self.eroot, "var", "repositories", repo)
                        self._repositories[repo] = {"location": repo_path}
                        profile_path = os.path.join(repo_path, "profiles")