diff options
author | Mykyta Holubakha <hilobakho@gmail.com> | 2017-06-03 12:35:14 +0300 |
---|---|---|
committer | Mykyta Holubakha <hilobakho@gmail.com> | 2017-06-03 12:35:14 +0300 |
commit | c51d2ac226e5b70b3281552483e07b3dcc733e22 (patch) | |
tree | cec06cd817881275faa02f423afbc09ade82ff32 | |
parent | Add missing imports (diff) | |
download | pomu-c51d2ac226e5b70b3281552483e07b3dcc733e22.tar.gz pomu-c51d2ac226e5b70b3281552483e07b3dcc733e22.tar.bz2 pomu-c51d2ac226e5b70b3281552483e07b3dcc733e22.zip |
Assure that portage repo initialization tests pass
-rw-r--r-- | pomu/repo/repo.py | 10 | ||||
-rw-r--r-- | tests/test_init.py | 1 |
2 files changed, 8 insertions, 3 deletions
diff --git a/pomu/repo/repo.py b/pomu/repo/repo.py index e8693ce..065c990 100644 --- a/pomu/repo/repo.py +++ b/pomu/repo/repo.py @@ -3,15 +3,18 @@ from os import path import portage -rsets = portage.db[portage.root]['vartree'].settings.repositories - def portage_repos(): + """Yield the repositories configured for portage""" + rsets = portage.db[portage.root]['vartree'].settings.repositories + for repo in rsets.prepos_order: yield repo def portage_repo_path(repo): """Get the path of a given portage repository""" - if repo in rsets.prepos_order: + rsets = portage.db[portage.root]['vartree'].settings.repositories + + if repo in rsets.prepos: return rsets.prepos[repo].location return None @@ -20,6 +23,7 @@ def pomu_status(repo_path): return path.isdir(path.join(repo_path, 'metadata', 'pomu')) def pomu_active_repo(): + """Returns a portage repo, for which pomu is enabled""" for repo in portage_repos(): if pomu_status(portage_repo_path(repo)): return repo diff --git a/tests/test_init.py b/tests/test_init.py index c4e635e..8341bce 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -49,4 +49,5 @@ class PortageRepoInitialization(unittest.TestCase): def testPortageCreate(self): self.assertTrue(init_portage_repo(True, REPO_DIR, REPO_PATH).is_ok()) + importlib.reload(portage) self.assertEqual(pomu_active_repo(), REPO_DIR) |