diff options
Diffstat (limited to 'pym/portage/tests/dep/test_match_from_list.py')
-rw-r--r-- | pym/portage/tests/dep/test_match_from_list.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/pym/portage/tests/dep/test_match_from_list.py b/pym/portage/tests/dep/test_match_from_list.py index 50b2b4a51..afba4141f 100644 --- a/pym/portage/tests/dep/test_match_from_list.py +++ b/pym/portage/tests/dep/test_match_from_list.py @@ -3,7 +3,7 @@ import sys from portage.tests import TestCase -from portage.dep import Atom, match_from_list +from portage.dep import Atom, match_from_list, _repo_separator from portage.versions import catpkgsplit if sys.hexversion >= 0x3000000: @@ -14,11 +14,12 @@ class Package(object): Provides a minimal subset of attributes of _emerge.Package.Package """ def __init__(self, atom): - atom = Atom(atom) + atom = Atom(atom, allow_repo=True) self.cp = atom.cp self.cpv = atom.cpv self.cpv_split = catpkgsplit(self.cpv) self.slot = atom.slot + self.repo = atom.repo if atom.use: self.use = self._use_class(atom.use.enabled) self.iuse = self._iuse_class(atom.use.required) @@ -37,7 +38,6 @@ class Package(object): def is_valid_flag(self, flags): if isinstance(flags, basestring): flags = [flags] - missing_iuse = [] for flag in flags: if not flag in self.all: return False @@ -76,7 +76,7 @@ class Test_match_from_list(TestCase): ("*/tar", ["sys-apps/portage-2.1.2"], [] ), ("*/*", ["dev-libs/A-1", "dev-libs/B-1"], ["dev-libs/A-1", "dev-libs/B-1"] ), ("dev-libs/*", ["dev-libs/A-1", "sci-libs/B-1"], ["dev-libs/A-1"] ), - + ("dev-libs/A[foo]", [Package("=dev-libs/A-1[foo]"), Package("=dev-libs/A-2[-foo]")], ["dev-libs/A-1"] ), ("dev-libs/A[-foo]", [Package("=dev-libs/A-1[foo]"), Package("=dev-libs/A-2[-foo]")], ["dev-libs/A-2"] ), ("dev-libs/A[-foo]", [Package("=dev-libs/A-1[foo]"), Package("=dev-libs/A-2")], [] ), @@ -86,13 +86,23 @@ class Test_match_from_list(TestCase): ("dev-libs/A[foo,bar(+)]", [Package("=dev-libs/A-1[-foo]"), Package("=dev-libs/A-2[foo]")], ["dev-libs/A-2"] ), ("dev-libs/A[foo,bar(-)]", [Package("=dev-libs/A-1[-foo]"), Package("=dev-libs/A-2[foo]")], [] ), ("dev-libs/A[foo,-bar(-)]", [Package("=dev-libs/A-1[-foo,bar]"), Package("=dev-libs/A-2[foo]")], ["dev-libs/A-2"] ), + + ("dev-libs/A::repo1", [Package("=dev-libs/A-1::repo1"), Package("=dev-libs/A-1::repo2")], ["dev-libs/A-1::repo1"] ), + ("dev-libs/A::repo2", [Package("=dev-libs/A-1::repo1"), Package("=dev-libs/A-1::repo2")], ["dev-libs/A-1::repo2"] ), + ("dev-libs/A::repo2[foo]", [Package("=dev-libs/A-1::repo1[foo]"), Package("=dev-libs/A-1::repo2[-foo]")], [] ), + ("dev-libs/A::repo2[foo]", [Package("=dev-libs/A-1::repo1[-foo]"), Package("=dev-libs/A-1::repo2[foo]")], ["dev-libs/A-1::repo2"] ), + ("dev-libs/A:1::repo2[foo]", [Package("=dev-libs/A-1:1::repo1"), Package("=dev-libs/A-1:2::repo2")], [] ), + ("dev-libs/A:1::repo2[foo]", [Package("=dev-libs/A-1:2::repo1"), Package("=dev-libs/A-1:1::repo2[foo]")], ["dev-libs/A-1::repo2"] ), ) for atom, cpv_list, expected_result in tests: result = [] for pkg in match_from_list( atom, cpv_list ): if isinstance(pkg, Package): - result.append(pkg.cpv) + if pkg.repo: + result.append(pkg.cpv + _repo_separator + pkg.repo) + else: + result.append(pkg.cpv) else: result.append(pkg) self.assertEqual( result, expected_result ) |