def test_repo_registry(self): from package.repos import get_repo, supported_repos g = get_repo("github") self.assertEqual(g.title, "Github") self.assertEqual(g.url, "https://github.com") self.assertTrue("github" in supported_repos()) self.assertRaises(ImportError, lambda: get_repo("xyzzy"))
def test_repo_registry(self): from package.repos import get_repo, supported_repos g = get_repo("github") self.assertEqual(g.title, "Github") self.assertEqual(g.url, "https://github.com") self.assertTrue("github" in supported_repos()) if settings.LAUNCHPAD_ACTIVE: l = get_repo("launchpad") self.assertEqual(l.title, "Launchpad") self.assertEqual(l.url, "https://code.launchpad.net") self.assertTrue("launchpad" in supported_repos()) self.assertRaises(ImportError, lambda: get_repo("xyzzy"))
def my_packages(self): """Return a list of all packages the user contributes to. List is sorted by package name. """ from package.repos import get_repo, supported_repos packages = [] for repo in supported_repos(): repo = get_repo(repo) repo_packages = repo.packages_for_profile(self) packages.extend(repo_packages) packages.sort(lambda a, b: cmp(a.title, b.title)) return packages
def my_packages(self): """Return a list of all packages the user contributes to. List is sorted by package name. """ from package.repos import get_repo, supported_repos packages = [] for repo in supported_repos(): repo = get_repo(repo) repo_packages = repo.packages_for_profile(self) packages.extend(repo_packages) packages.sort(key=lambda a: a.name) return packages